Get reference Upper on rebar 51

Get reference Upper on rebar 51

sizy458
Advocate Advocate
383 Views
1 Reply
Message 1 of 2

Get reference Upper on rebar 51

sizy458
Advocate
Advocate

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.

0 Likes
384 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

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

0 Likes