Пример #1
0
        public static Polygon GetPolygonFromFaceFamilyInstance(FamilyInstance fi)
        {
            GeometryElement geoElem = fi.get_Geometry(new Options {
                ComputeReferences = true
            });
            List <Curve> cs = new List <Curve>();

            foreach (GeometryObject geoObj in geoElem)
            {
                GeometryInstance geoIns = geoObj as GeometryInstance;
                if (geoIns == null)
                {
                    continue;
                }
                Transform tf = geoIns.Transform;
                foreach (GeometryObject geoSymObj in geoIns.GetSymbolGeometry())
                {
                    Curve c = geoSymObj as Line;
                    if (c != null)
                    {
                        cs.Add(GeomUtil.TransformCurve(c, tf));
                    }
                }
            }
            if (cs.Count < 3)
            {
                throw new Exception("Incorrect input curve!");
            }
            return(new Polygon(cs));
        }