I have noticed that I cannot seem to get a SUAxesRef object from a SUComponentDefinition object. But there is a SUComponentDefinitionSetAxes function available.
Am I correct in thinking that a Component Definition has its own “fixed” axes, independent of the fixed model axes? So when SUComponentDefinitionSetAxes is called on a ComponentDefinitionRef, all entities inside the definition has its positions/orientation changed (ie it is transformed)?
If so, I guess that when adding entities to a ComponentDefinition with the C SDK, you do so as if the SUComponentDefinitionRef has fixed axes like a SUModelRef.
In which case, a GroupRef seems to work completely differently, and continues to use the Model axes? This seems very different from the Group concept in the Ruby API, which has its own ComponentDefinition, of sorts.
I’d appreciate i someone could clarify or confirm the above.
Yes. all entities in a definition are relative to the definition’s own origin. In fact, if you import a SKP it comes in as a definition. Likewise if you do a Save As on a definition it result in a SKP. Effectively a definition is a model.
A group always have a definition. It’s just that the C API hid it more - for reasons unknown to me. But Sketchup::Group and SUGroupRef wraps the same internal object.
Ah! Yes, I didn’t notice the SUGroupGetDefinition function until now. Thanks for clarifying.[quote=“thomthom, post:2, topic:29724”]
Am I correct in thinking that a Component Definition has its own “fixed” axes, independent of the fixed model axes?
Yes. all entities in a definition are relative to the definition’s own origin. In fact, if you import a SKP it comes in as a definition. Likewise if you do a Save As on a definition it result in a SKP. Effectively a definition is a model.
[/quote]
Thanks for this, so when SUComponentDefinitionSetAxes is called on a ComponentDefinitionRef, all entities inside the definition has its positions/orientation changed (ie it is transformed)? This would be a different behaviour to when the axes are changed on the ModelRef, which retains the fixed “world” axes (and so the coordinate values of the contained entities do not change when the axes are “moved”).