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). @DanRathbun
(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.
Try:
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.
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.