I consistent get a crash if I try to use the ruby entities.transform_entities() but provide entities in the argument that are not in the entities I invoked the function on. To fix this crash add a check that the entities in the argument have the correct inheritance.
It would be appropriate for transform_entities to throw an exception instead of crashing. You should add an item to the api issues tracker for this.
That said, the problem strikes me as a code design error on your part. If you understand what the method is intended to do, you shouldn’t be feeding it an Entity from a different collection in the first place!
I do not see this crash issue listed:
What SketchUp version do you see this on? Is it only on Mac or also on Windows?
I agree with this point. An
ArgumentError would be appropriate with a message similar to “argument entity not in collection”.
The API docs for
#transform_entities do indicate that the entities to be transformed are “sub-entities”.
I would rather the description said “member entities of the receiver collection …”
This method is nice because it can transform primitive drawing elements as well as groups or instance objects. It also wraps everything into one undo operation and is more efficient than transforming objects one by one.