Open SnowyEgret opened 2 years ago
RELATED: Attempts to create a new InstancePath
object with it's class constructor also fail to create a valid instance path when a group is the leaf.
I also see this on SU2021.
We can only get a valid path if the leaf is a primitive.
Logged as: SKEXT-3342
Avoid calling the Sketchup::Model#drawing_element_visible? method upon groups and instances by using a conditional expression (whilst this issue remains unfixed) ...
def self.is_any_object_or_geometry_hidden?(entities, path = [])
#
entities.any? { |entity|
entity_path = path + [entity]
if entity.respond_to?(:definition)
break true if is_any_object_or_geometry_hidden?(
entity.definition.entities, entity_path
)
else
break true if !entity.model.drawing_element_visible?(entity_path)
end
#
false # default return for the block
}
#
end
Unfortunately, there appears to not be an easy workaround when the entity is an Sketchup::Image
object.
it will not also accept leaf of type ComponentInstance
Sketchup::Model#drawing_element_visible? throws an error when the leaf of an array representing an instance path is a Sketchup::Group
throws
Please reference Developer's RubyAPI forum topic Drawingelement#visible? seems to return inconsistent results
SketchUp Pro 2022 Windows 10