Recommendations for animation code?

The API documentation for parent says that the return value is an “object”. I have noticed that this object is either the main model or the “definition” that the drawing element is in. Definitions (and the main model) don’t have associated transformations, instances do.

If there were a method for a parent instance, to be meaningful, its name should be pluralized (e.g. parent_instances) and it would return an array (or collection of some sort). Drawing elements can be reused and therefore can have multiple parent instances.

You can obtain a reference to a drawing element by selecting it with Sketchup’s select tool and performing a method call. If your search the entire entities collection for an object that is nested inside of a grouped object, you may encounter multiple occurrences of the same object inside of other entities.

That question gets asked alot. As a hobbiest animator, I use a pick helper tool to give me the fixed path to an entity that I want to animate, but usually I configure the model so that the entity being animated is a grouped object in the outer most entities collection.

That was recently responded to by:

I like that @Aerilius used the term “occurrences” in the description and code. Quite appropriate. I should have clicked “like” to the response, but I haven’t run the code and tested it out.

1 Like