Community

Revit API Forum

Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

This page has been translated for your convenience with an automatic translation service. This is not an official translation and may contain errors and inaccurate translations. Autodesk does not warrant, either expressly or implied, the accuracy, reliability or completeness of the information translated by the machine translation service and will not be liable for damages or losses caused by the trust placed in the translation service.
Translate

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Message 1 of 5

03-06-2019
11:42 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report

03-06-2019
11:42 AM

I am working on a geometry exporter from Revit and am having some issues with UV values. I can successfully retrieve the UV values from PolymeshTopology nodes, but the generated renderings don't look quite right. Here are two assumptions that i have made (I think one or both of them are wrong)

1- I loop through PolymeshFacet instances for each PolymeshTopology and get the points and their associated UV:

XYZ p1 = polymeshTopology.GetPoint(polymeshFacet.V1);

UV p1Uv = polymeshTopology.GetUV(polymeshFacet.V1);

My first question: Is that the correct way of retrieving a point and the associated UV?

Second questions: The final UV values need to be converted to a [0.00, 100] scale, but the values out of Revit can be larger than 1, so I basically just use the fraction part and ignore the rest, is that the correct conversion?

Solved! Go to Solution.

Solved by JimJia. Go to Solution.

4 REPLIES 4

Message 2 of 5

03-09-2019
06:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report

03-09-2019
06:15 AM

Dear Ehsan Barekati,

Can you help to clarify the rendering issue? what's wrong with the rendering?

Besides, you may refer to these pages, hope it's helpful:

https://thebuildingcoder.typepad.com/blog/2013/07/adn-mesh-data-custom-exporter-to-json.html

https://thebuildingcoder.typepad.com/blog/2016/07/exporting-rvt-bims-to-webgl-and-forge.html

Jim Jia

Autodesk Forge Evangelist

https://forge.autodesk.com

Developer Technical Services

Autodesk Developer Network

Email: Jim.Jia@autodesk.com

Message 3 of 5

03-11-2019
04:27 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report

03-11-2019
04:27 PM

Hi Jim,

Yeah absolutely, I am attaching two images, one that's from my rendering, and the other one directly from Revit. They should ideally look similar, but as you can see the UV mapping on the exported one is not correct.

The rendering system that I am exporting to, uses a [0.00, 100] scale, where the bottom left pixel of the texture image has a (0,0) UV and the top right has (1,1). So my question is how can I translate the UV values in Revit to that scale?

Message 4 of 5

03-12-2019
09:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report

03-12-2019
09:58 AM

Here is a more detailed example:

I created a simple wall in Revit and added a simple wall material to it:

The Texture is a 219*256 png:

Here is the UV values that I get when exporting the model using Custom Export:

U: 0 V: 0

U: 8.5 V: 3.34431

U: 8.5 V: 0

U: 8.5 V: 3.34431

U: 0 V: 0

U: -8.5 V: 3.34431

U: -8.5 V: 0

U: 0 V: 3.34431

U: 0 V: 0

U: 0 V: 3.34431

U: 8.5 V: 0.333333

U: 1.06643e-15 V: 0.333333

U: 8.5 V: -0.333333

U: -1.06643e-15 V: -0.333333

U: 8.5 V: -0.333333

U: 1.06643e-15 V: 0.333333

U: -0.333333 V: 3.34431

U: -0.333333 V: 0

U: 0.333333 V: 0

U: 0.333333 V: 0

U: 0.333333 V: 3.34431

U: -0.333333 V: 3.34431

U: 8.5 V: -0.333333

U: 8.5 V: 0.333333

U: 8.5 V: 0.333333

U: 0 V: 0.333333

U: 1.77636e-15 V: -0.333333

U: 0.333333 V: 0

U: 0.333333 V: 3.34431

U: -0.333333 V: 3.34431

U: -0.333333 V: 3.34431

U: -0.333333 V: 0

U: 0.333333 V: 0

U: 0.0131127 V: -0.0100617

U: 0.0104167 V: -4.68375e-17

U: 0.0104167 V: -4.68375e-17

U: 0.015625 V: -0.0090211

U: 0.0177824 V: -0.0073657

U: 0.015625 V: -0.0090211

U: 0.0104167 V: -4.68375e-17

U: 0.0131127 V: -0.0100617

U: 0.0204784 V: -0.00269603

U: 0.0104167 V: -4.68375e-17

U: 0.0194378 V: -0.00520833

U: 0.0208333 V: -4.68375e-17

U: 0.0104167 V: -4.68375e-17

U: 0.0204784 V: -0.00269603

U: 0.0194378 V: -0.00520833

U: 0.0104167 V: -4.68375e-17

U: 0.0177824 V: -0.0073657

U: 0.000354939 V: 0.00269603

U: 0.0104167 V: 3.14465e-17

U: 0.0104167 V: 3.14465e-17

U: 0.00305097 V: 0.0073657

U: 0.00139557 V: 0.00520833

U: 0.0104167 V: 3.14465e-17

U: 0.000354939 V: 0.00269603

U: -1.9082e-17 V: 3.14465e-17

U: 0.00520833 V: 0.0090211

U: 0.0104167 V: 3.14465e-17

U: 0.00772063 V: 0.0100617

U: 0.0104167 V: 3.14465e-17

U: 0.00520833 V: 0.0090211

U: 0.00305097 V: 0.0073657

U: 0.0104167 V: 0.0104167

U: 0.00772063 V: 0.0100617

U: 0.0104167 V: 3.14465e-17

U: 0.0131127 V: -0.0100617

U: 0.0104167 V: -4.68375e-17

U: 0.0104167 V: -4.68375e-17

U: 0.015625 V: -0.0090211

U: 0.0177824 V: -0.0073657

U: 0.015625 V: -0.0090211

U: 0.0104167 V: -4.68375e-17

U: 0.0131127 V: -0.0100617

U: 0.0204784 V: -0.00269603

U: 0.0104167 V: -4.68375e-17

U: 0.0194378 V: -0.00520833

U: 0.0208333 V: -4.68375e-17

U: 0.0104167 V: -4.68375e-17

U: 0.0204784 V: -0.00269603

U: 0.0194378 V: -0.00520833

U: 0.0104167 V: -4.68375e-17

U: 0.0177824 V: -0.0073657

U: 0.000354939 V: 0.00269603

U: 0.0104167 V: 3.14465e-17

U: 0.0104167 V: 3.14465e-17

U: 0.00305097 V: 0.0073657

U: 0.00139557 V: 0.00520833

U: 0.0104167 V: 3.14465e-17

U: 0.000354939 V: 0.00269603

U: -1.9082e-17 V: 3.14465e-17

U: 0.00520833 V: 0.0090211

U: 0.0104167 V: 3.14465e-17

U: 0.00772063 V: 0.0100617

U: 0.0104167 V: 3.14465e-17

U: 0.00520833 V: 0.0090211

U: 0.00305097 V: 0.0073657

U: 0.0104167 V: 0.0104167

U: 0.00772063 V: 0.0100617

U: 0.0104167 V: 3.14465e-17

As you can see, the values are in a range from -8.5 to 8.5, how would each UV map to a pixel on the texture PNG?

Message 5 of 5

03-15-2019
01:18 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report

03-15-2019
01:18 AM

Dear Ehsan Barekati,

*>>> Is that the correct way of retrieving a point and the associated UV?*

Yes, your way is correct. But note that one vertex contains only one uv, so the vertex in several facets has the same uv value. This is the reason why the uv value may be in a big range.

*>>> The final UV values need to be converted to a [0.00, 100] scale, but the values out of Revit can be larger than 1, so I basically just use the fraction part and ignore the rest, is that the correct conversion?*

The UV value has strong connection with image mapping (you should find this via Asset API). The Real World Scale and Real World Offset will affect why UV value mapping to the real picture, the scale value defines the UV unit, and the offset value defines the UV offset.

*>>> how would each UV map to a pixel on the texture PNG?*

As I mentioned above, the Real World Scale and Real World Offset will affect UV value mapping to the real picture. For example, the UV value is (1, 1), the X scale and y scale define the real length (of data 1) in picture mapping, and the offset define the offset for UV value (0,0) also.

Jim Jia

Autodesk Forge Evangelist

https://forge.autodesk.com

Developer Technical Services

Autodesk Developer Network

Email: Jim.Jia@autodesk.com

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page