Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

face.Evaluate() returns wrong result on angled Face

florian.schaeferTJTBZ
Explorer

face.Evaluate() returns wrong result on angled Face

florian.schaeferTJTBZ
Explorer
Explorer

Hello, I recently ran into an issue creating families on a face where I don’t understand what’s going on. 

I’m trying to place families in a grid onto a surface.

 

For example, four instances at UV(10,10), UV(20,20), UV(30,30), UV(40,40)

 

 

_uv = new UV(10, 10);

location = face.Evaluate(_uv);

Document.Create.NewFamilyInstance(_reference,location  , new XYZ(0, 0, 0), _symbol);

 

 

It works like i would expect.

FlachmitPaneln.PNG

 

when my Face is angled like this:


 Schräg.PNG

 

the panels will be placed like this:

 

SchrägmitPanel.PNG

 

The face evaluation returns XYZ Positions that aren’t on the face anymore. Even the origin changes.
Why does Revit calculate it like this? And how do I have to evaluate the correct XYZ on the angled Face, so I can create my families?

0 Likes
Reply
Accepted solutions (1)
243 Views
1 Reply
Reply (1)

jeremy_tammik
Autodesk
Autodesk
Accepted solution

Ours is not to reason why; ours is but to do or die...

  

Why Revit does this is not really helpful to know (we'll provide a hint below anyway).

  

How can this be handled? Now there is a useful question. In the distant past, Scott Conover explained the basics of the Revit geometry library, including face parametrisation:

  

https://thebuildingcoder.typepad.com/blog/2010/01/faces.html

  

You can never rely on the origin being in any specific location on a face. It depends on how the face was created. If the face is part of an element E, and you intersect E with another element F and subtract or join or otherwise modify the geometry, you might end up with new faces that have seemingly arbitrarily positioned origins.

  

So, when you meet a new face, you need to query it for its parametrisation. Where is your origin? Which direction are your U and V vectors pointing? How is you U and V scaling defined? Once you have determined all those factors, you can start calculating UV points and correlating them with real-world XYZ 3D locations.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open