Edit_transform not available in the C-API?
-
Hey folks,
SketchUp offers the edit_transform instance model for the model: https://ruby.sketchup.com/Sketchup/Model.html#edit_transform-instance_method - However, it seems that there's no equivalent in the C-API. I checked the documentation of the SUModelRef: https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/struct_s_u_model_ref.html.
Am I not looking in the right place, or is there an alternative way to get the edit_transform?
Cheers,
Thomas -
The C API is mainly written to act upon files.
There is only some limited things you can do with "live" models.
Currently, the C API cannot be used to modify the active model.
You can get the active edit path via: SUModelGetActivePath()
... and from it the transform via: SUInstancePathGetTransform() -
@dan rathbun said:
The C API is mainly written to act upon files.
There is only some limited things you can do with "live" models.
Currently, the C API cannot be used to modify the active model.
You can get the active edit path via: SUModelGetActivePath()
... and from it the transform via: SUInstancePathGetTransform()Thanks, Dan, for the information! I solved it in my code by having a ModelObserver, implementing onActivePathChanged, and passing it to my C-extension code.
Even though you cannot modify the active model, you still need to know the edit transformation for some cases. If a user opens a model to edit, if you query the instance transformation, it will be a world-coordinate transformation instead of a transformation relative to the parent. My C code assumes transformations relative to the parent, so I must calculate that using the edit transformation. You probably already knew this, but I'm putting it here for posterity.
Cheers,
Thomas
Advertisement