/// <summary>
        /// Gets all the solids from an element (digs into them too!). see: https://forums.autodesk.com/t5/revit-api-forum/getting-beam-column-and-wall-geometry/td-p/8138893
        /// </summary>
        /// <param name="elem"></param>
        /// <param name="opt"></param>
        /// <param name="useOriginGeom4FamilyInstance"></param>
        /// <returns></returns>
        public static List <Solid> GetElementSolids(Element elem, Options opt = null, bool useOriginGeom4FamilyInstance = false)
        {
            if (null == elem)
            {
                return(null);
            }
            if (null == opt)
            {
                opt = new Options();
            }
            List <Solid>    solids = new List <Solid>();
            GeometryElement gElem  = null;

            try
            {
                if (useOriginGeom4FamilyInstance && elem is Autodesk.Revit.DB.FamilyInstance)
                {
                    // we transform the geometry to instance coordinate to reflect actual geometry
                    Autodesk.Revit.DB.FamilyInstance fInst = elem as Autodesk.Revit.DB.FamilyInstance;
                    gElem = fInst.GetOriginalGeometry(opt);
                    Transform trf = fInst.GetTransform();
                    if (!trf.IsIdentity)
                    {
                        gElem = gElem.GetTransformed(trf);
                    }
                }
                else
                {
                    gElem = elem.get_Geometry(opt);
                }
                if (null == gElem)
                {
                    return(null);
                }
                IEnumerator <GeometryObject> gIter = gElem.GetEnumerator();
                gIter.Reset();
                while (gIter.MoveNext())
                {
                    solids.AddRange(GetSolids(gIter.Current));
                }
            }
            catch (Exception ex)
            {
                // In Revit, sometime get the geometry will failed.
                string error = ex.Message;
            }
            return(solids);
        }