Transform that Family Instance Geometry

Oh, if I had a nickel for every time I forgot (and later remembered) that geometry of family instances needs to be transformed like this…

Transform transform = null;
if (elem is FamilyInstance)
{
    FamilyInstance fi = elem as FamilyInstance;
    transform = fi.GetTransform();
}
                    
PlanarFace pf = elem.GetGeometryObjectFromReference(r) as PlanarFace;
if (pf == null)
    continue;
XYZ norm = pf.FaceNormal;
if (transform != null)
{
    norm = transform.OfVector(norm);
}

2 thoughts on “Transform that Family Instance Geometry

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s