How to Transform the components in SketchUp to world space



I have been able to read all component instance, groups and faces in a model using the C++ sdk. When I render it, they are not correctly transformed. I used geometry.h and that helped me with some models and for some models its not working.
The positioning of components are not well.
I am taking the SUTransformation from each groups and instances and applying to SUPoint3D vertices of faces.
Do I need to provide an additional check for correct transformation ?
I read the answer on this post - Component Instance Transformation
But couldn’t work upon it much !


No one has responded for 8 days. I haven’t because your question is C++ SDK related, and I normally answer for the Ruby API. Faces are defined by edges, which have a vertex object, and each vertex has a position. If a face (and its associated edges) are nested inside a component, then its vertex positions are relative to the component instance’s local coordinate system, which is defined by the component instance’s transformation. You have to apply the transformation to the position to convert it to external (or extrinsic) coordinates.

If the component instance mentioned above is nested inside another grouped object, then you have to apply its transformation, and any other transformations to obtain world coordinates/space. If the component instance containing the face object had its transformation named “inner_transformation”, then a world transform could be determined in Ruby with the following:

world_transform = outer_transformation * middle_transformation * inner_transformation

I don’t know what the equivalent in the C++ SDK is. I was under the impression that the SDK does not have built-in geometry functions for points, vectors, and transformations.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.