.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Obtaining texture UV coordinates

11 REPLIES 11
Reply
Message 1 of 12
pfk
Enthusiast
1924 Views, 11 Replies

Obtaining texture UV coordinates

Hi

 

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?

 

Thanks

11 REPLIES 11
Message 2 of 12
pfk
Enthusiast
in reply to: pfk

Bumping - still looking for a method to get UV coordinates from polygons in AutoCAD.

 

Can anyone assist pls?

 

Thanks

Message 3 of 12
Balaji_Ram
in reply to: pfk

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.

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 4 of 12
pkinnane
in reply to: Balaji_Ram

Hi

 

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?

 

Thanks

Message 5 of 12
pkinnane
in reply to: pkinnane

Sorry - replied from the wrong account - this is the original poster.

Message 6 of 12
Balaji_Ram
in reply to: pfk

Hi,

 

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.

 

Regards,

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 7 of 12
Balaji_Ram
in reply to: pfk

Hi,

 

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.

 

Regards,



Balaji
Developer Technical Services
Autodesk Developer Network

Message 8 of 12
pkinnane
in reply to: Balaji_Ram

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.

 

Thanks again.

 

Paul

Message 9 of 12

Hello, I am also looking for the answer to this question. Today is 2021. Is there a new way to solve this problem?

Message 10 of 12
zhengyunyang2019
in reply to: pfk

Hello, I am also looking for the answer to this question. Today is 2021. Is there a new way to solve this problem?

Message 11 of 12
haroon.haider39ZXL
in reply to: pfk

I am also looking to figure this issue out. An updates on this would be great.

Message 12 of 12
khoiepu5
in reply to: pfk

I am still looking solution for this problem.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost