I am trying to write a 3d geometry exporter for AutoCAD.
Firstly, is iterating through the document database, and processing any Solid3d, Region & Body entities the best way to do this, or is there a faster way to access the 3d geometry?
Secondly, I assume using the first approach above, I need to process each entity as a Brep in order to get the vertices, polygons, etc. In this case, how are the UV coordinates for each vertex obtained pls?
Sorry for the delay.
By UV coordinates, do you mean the pixel coordinates in the image that was used as a texture for the polygon ?
Sorry, if I did not understand your question. If you can provide more details with drawings, texture image and clear steps about what you are trying to retrieve from that drawing, that will help.
Thanks for your response.
I want to export AutoCAD geometry to an OBJ file, and want to include the UV texture mapping coordinates in the OBJ file. When exporting a Nurbs Surface, using nurbSurface.GetParameterOfPoint(point3d, out u, out v); to get the UV returns the point on the Nurb surfaces, but this is not the UV texturemapping coordinate (since this is in the MaterialMapper a a transform). Often the uv's from GetParameterOfPoint are rotated 90 degrees away from what the AutoCAD viewport is displaying (presumeably because the MaterialMapper transform contains a rotation).
How can I use the u/v returned by GetParameterOfPoint to calculate the uv texturemap coordinate via the MaterialMapper pls?
Also, for Meshes, there is no surface, so how can the UV texturemap coordinate be returned for these geometry items?
Sorry for the delay. I have spent some time trying to understand the transform provided by the material mapper.
Although the transform provides the offset, scale and rotation values, AutoCAD also considers other inputs such as tiling and type of projection while mapping material on to the mesh.
I still cannot figure out a way to know the texture image coordinates corresponding to a given point on the mesh. I have contacted our engineering team to know if there is a way to get this information. I will keep you updated after I get a response.
Based on what I heard from our engineering team, it is not possible to get the texture coordinates from the geometry coordinates. The texture map transform along with other parameters such as tiling and projection make it a complex transformation which is not possible to get at present using the API.
Sorry about that.
Thank you Balaji. I appreciate the effort you've taken to look into this. Obtaining texture coordinate UV's from the Revit and Inventor API's is quite straighforward, so hopefully the AutoCAD API team will consider adding this to a future version of AutoCAD, because it would be very useful.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.