예제 #1
0
        public static Face3D ToSAM_Face3D(this CurveArray curveArray, XYZ normal = null, bool flip = false)
        {
            Polygon3D polygon3D = curveArray?.ToSAM_Polygon3D(normal);

            if (polygon3D == null)
            {
                return(null);
            }

            if (flip)
            {
                polygon3D.Reverse();
            }

            return(new Face3D(polygon3D));
        }
예제 #2
0
        public static List <Face3D> ToSAM_Face3Ds(this Sketch sketch, bool flip = false)
        {
            if (sketch == null)
            {
                return(null);
            }

            CurveArrArray profile = null;

            try
            {
                profile = sketch.Profile;
            }
            catch
            {
                profile = null;
            }

            if (profile == null)
            {
                return(null);
            }

            XYZ normal = sketch.SketchPlane?.GetPlane()?.Normal;

            List <Polygon3D> polygon3Ds = new List <Polygon3D>();

            foreach (CurveArray curveArray in sketch.Profile)
            {
                Polygon3D polygon3D = curveArray?.ToSAM_Polygon3D(normal);
                if (polygon3D == null)
                {
                    continue;
                }

                if (flip)
                {
                    polygon3D.Reverse();
                }

                polygon3Ds.Add(polygon3D);
            }

            return(Spatial.Create.Face3Ds(polygon3Ds));
        }