I apologize for the revisit, but I’m still having difficulty navigating this. I’m building some Classes, and one of my Classes inherits functionality from another and extends a function using super. That all works fine, my child Class creates the same base geometry as the parent Class and I’m working to modify it. What I have:
@entity # Sketchup::Group container # Sketchup::Entities, container = @entity.entities
I need to put all of the entities from container into a subgroup - I intend to create a second subgroup, add entities directly to that, and then use a solid operation to subtract the subgroups with the intent of ending up again with raw geometry inside @entity.
I’ve gone through the numerous threads:
Add an array of entities into an existing group
Understanding the move an existing group into another group Challenge
Entities.add_group causes Bugsplat!
Move all entities to new group
So what I’ve tried:
model = Sketchup.active_model entities = model.active_entities newgroup = entities.add_group(container.to_a) # working in active context (I hope) # the above line also duplicates & offsets the geometry by the bounding box instance = container.add_instance(newgroup.definition, IDENTITY) # move instance to desired context newgroup.explode
That results in ungrouped raw geometry and a group within a group of the same geometry except the groups are offset by the bounding box of the original geometry. I’m almost there, but the offset is driving me insane and I’m not sure how to fix it. I know that’s consistent with the bug @eneroth3 posted here but maybe I’m not working in the current context? Attempts to explode ‘instance’ result in a massive crash, not even a BugSplat (SU2021).
UPDATE: I am still curious about learning what I’m doing wrong, but in the meantime I created a new group in active_entities, added entities to that, then did the solid operation with @entity and my new group, assigning the output difference operation back to @entity and I’m able to get on with my life.