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: 

Get reference Upper on rebar 51

1 REPLY 1
Reply
Message 1 of 2
sizy458
217 Views, 1 Reply

Get reference Upper on rebar 51

Hello,

this line code work on some rebar 51 for retreive reference of upper face.

var reppref =  $"{rebar51.UniqueId}:2000000:{1002000+typ}:LINEAR";
                  
 var refr = Reference.ParseFromStableRepresentation(rebar51.Document, reppref);

 

Iin programming is there a simpler method ?

That is to get instance 'Reference' upper top face of the rebar form '51' (Rebar) ???

 

Thank.

1 REPLY 1
Message 2 of 2
jeremytammik
in reply to: sizy458

You can ask the rebar for its geometry using the Element.Geometry property:

 

https://www.revitapidocs.com/2020/d8a55a5b-2a69-d5ab-3e1f-6cf1ee43c8ec.htm

 

It takes an Options argument in which you can specify ComputeReferences = true.

 

Iterate over the geometry solids and their faces, pick the face that you want, e.g., based on its normal vector (pointing upwards) and vertex locations (maximal Z values), and use the reference that it comes equipped with.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

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


Rail Community