Community
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.
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.