SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
38 stars 10 forks source link

[BUG] `Face#area` is reported wrongly in SU 2023-24, where there are glued components on the outer loop #964

Open dphdave opened 1 month ago

dphdave commented 1 month ago

Bug Report

1. SketchUp/LayOut Version: Expected behaviour verified on Mac in SU2017 - 2022, issue observed on Mac and Win in SU2023.1 & SU2024.0 (SU2023.0 not tested)

2. OS Platform: Observed on Mac OS 11.7.10 (Big Sur), and Windows 11

Describe briefly what you are doing and what is happening

The area of glued Component Instances is no longer being subtracted from the gross area of a face when the glued Component Instance is snapped to an edge, or perimeter vertex, of the parent face. This discrepancy can be observed in the SketchUp Entity Info panel, and also through calling Face#area. This issue applies to any glued component instance, that is snapped to an edge, or vertex on a concave corner, of the parent face.

This is problematic for extensions that are taking off areas from the model, for example for building energy analysis, as glued Component Instances are often used to represent windows. This change in behaviour means that the user will get different results for the same model in different versions of SketchUp.

Describe what the expected result is

The previous / expected behaviour is that the areas of glued Component Instances are subtracted from the gross area of faces, thus SketchUp reports the net area of faces in the Entity Info panel and through the Ruby API.

Attachments

Attached are screenshots and a model of a simplified abstract case that demonstrates the issue:

(1) Island glued instances still behave as expected in all tested SketchUp versions

Island glued components - correct

(2) & (3) Glued instances at edge or vertex report face area incorrectly in SU2023-24

Glued components at edge - incorrect Glued components at edge or vertex - incorrect

Face#area discrepancy.skp.zip

rafhik commented 1 month ago

Same discrepancy with #outer_loop (Skp 2024 Mac) . See the diference in the example attached outer loop discrepancy.zip

Captura de pantalla 2024-05-05 a las 9 21 23

Captura de pantalla 2024-05-05 a las 9 21 48

face = Sketchup.active_model.selection.first
outer_perimeter = face.outer_loop
edgesCount = 0
perimeter = 0

outer_perimeter.edges.each do |e|
  perimeter += e.length
  edgesCount += 1
end

puts "Perimeter: " + Sketchup.format_length(perimeter)
puts "Perimeter Edges: " + edgesCount.to_s
sketchup[bot] commented 1 month ago

Logged as: SKEXT-4183