UV coordinates of component

I have a problem in reading uv coordinates of component. I do it like this:

  1. use SUTextureWriterLoadFace to load faces of a ComponentInstance.
  2. use SUMeshHelperCreateWithTextureWriter to convert faces to mesh
  3. use SUMeshHelperGetFrontSTQCoords to get uv coordinates

But when i use these uv coordinates , i find it’s wrong.
Is there something i have missed?

the scene i load

the scene in skp

1 Like

Does there have something like a scale factor which i should take into account? thanks

Yes, component instances and groups have transformations.

Thank you. Does you mean the STQCoords should multiply the transform of component instances.Such as:
STQ = matrix * STQ;

I use SUComponentInstanceGetTransform to get the transform of component instances. But i found the scale factor is (1,1,1).

Also, this transform is already set to the node of scene , the mesh is hanged on the node.

44.skp (406.8 KB)

@ DanRathbun

Hi, Is there a example can show how to do this?

I do not know, try:


Then, in this case, it would be meaningless multiplying by 1, right ?

Yet, you will not know until you examine the transformation matirx.

Maybe i didn’t make it clear. The transform get form SUComponentInstanceGetTransform is :


Listen, you asked a general question:

… and I gave a general answer:

I do not know why you are having problems.
In your original post, you said:

You have not said what is wrong, or how it is wrong.

Nor have you said what you expected from the code.

Just a note: A ComponentInstance does not “have” any faces.
Only a ComponentDefinition has an entities collection.

In SketchUp models, the component instance can be painted with a material, which will render (for this instance only,) upon all the child faces of the component’s definition, if they do not have their own material assignments.

So if a certain face needs a unique texture mapping, then the material must be assigned directly to the face, and this material object will need to be unique for this face. It cannot be shared even if the original texture image file was the same as that used by other faces, or other components at the instance level.

Also, I myself do not care for C or C++ language, and do not program in it, (but can read and understand the idea of what the code is doing,) … but I cannot help much if it is C language nitty issue.

As you say, the component instance can be painted with a material. I want to know how the texture of material is mapped to the object and get the mapping uv. When i use the uv from SUMeshHelperGetFrontSTQCoords and set to my scene, the texture looks too dense when compared to the scene in SketchUp (refer to the image i upload before).

(1) Your scene in what ? Is this in some other modeling application ?

(2) Do you really need to convert to a mesh ? If what you are doing is not working, then try a different approach.


Access the component’s definition. Iterate it’s entities collection, checking it’s faces. Get the face’s material, get the material’s texture object, and use it’s property functions.

Then get the face’s UVHelper object, get the face’s front or back SUUVQ struct, from the UVHelper’s SUUVHelperGetFrontUVQ() or SUUVHelperGetBackUVQ() functions.

Then apply the component instance’s transformation scaling (if it is not [1.0,1.0,1.0].)

You asked about a texture’s scale. See:

Reference these:

I am not a C programmer, but even I was able to find this information quite quickly, just by browsing the API documentation, starting with the list of all the data structures:

@yueshiwu, Please stop pinging me directly for this thread. Just post your questions, and if someone can answer them, and has the time, they will (eventually.)

Thank you for your patient reply! I have find the approach to solve this problem.

If a face of component instance doesn’t have a material, use SUFaceSetFrontMaterial to set the material of component to it.
Then the uv get from SUTextureWriterGetFrontFaceUVCoords is right.