Skip to content

Commit

Permalink
Merge pull request #123 from openstudiocoalition/sort_by_size
Browse files Browse the repository at this point in the history
Sort by size
  • Loading branch information
macumber authored Nov 12, 2023
2 parents 4a90423 + 38ceb37 commit 8e04012
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugin/openstudio/lib/interfaces/ModelInterface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,17 @@ def attach_openstudio_model()
end

# Sort the drawing interfaces according to the "draw order".
drawing_interfaces.sort! { |a, b| @draw_order.index(a.class) <=> @draw_order.index(b.class) }
drawing_interfaces.sort! do |a, b|
result = @draw_order.index(a.class) <=> @draw_order.index(b.class)
if result == 0
# class specific sorting
if a.is_a?(PlanarSurface)
result = b.model_object.grossArea.to_f <=> a.model_object.grossArea.to_f
end
end

result
end

# Reattach drawing interfaces and entities.
for drawing_interface in drawing_interfaces
Expand Down

0 comments on commit 8e04012

Please sign in to comment.