I'm trying to get the midpoint, or any XYZ point really, of conduit and cable tray fittings so as to automatically apply an angle tag to them. I've already figured out getting the midpoint of straight pieces of conduit and auto tagging them, but am stuck on how to get the midpoint of a conduit's elbow fitting. If someone could point me to an SDK sample or building coder post or post a block of code here that points me in the right direction it would be much appreciated! Thanks.
Fittings are family instances. A family instance has a
Location
property. In the case of a fitting, it is actually aLocationPoint
. Cast theLocation
property to a LocationPoint and query its point:Location loc = fam_inst.Location; LocationPoint lp = loc as LocationPoint XYZ p = (null == lp) ? XYZ.Zero : lp.Point;