Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

face.Evaluate() returns wrong result on angled Face

1 REPLY 1
SOLVED
Reply
Message 1 of 2
florian.schaeferTJTBZ
213 Views, 1 Reply

face.Evaluate() returns wrong result on angled Face

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?

Tags (4)
Labels (4)
1 REPLY 1
Message 2 of 2

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

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

Post to forums  

Autodesk Design & Make Report