示例#1
0
        /***************************************************/
        /****             Interface Methods             ****/
        /***************************************************/

        public static oM.Geometry.ICurve IFromRevit(this Curve curve)
        {
            oM.Geometry.ICurve result = FromRevit(curve as dynamic);

            if (result == null)
            {
                BH.Engine.Reflection.Compute.RecordWarning("Curve types without conversion support have been tessellated and converted into Polylines.");

                IList <XYZ> xyzList = curve.Tessellate();
                if (xyzList == null || xyzList.Count < 2)
                {
                    result = null;
                }
                else
                {
                    result = new BH.oM.Geometry.Polyline {
                        ControlPoints = xyzList.Select(x => x.PointFromRevit()).ToList()
                    }
                };
            }

            return(result);
        }

        /***************************************************/
    }
示例#2
0
        /***************************************************/

        public static List <Curve> ToRevitCurves(this BH.oM.Geometry.Polyline curve)
        {
            return(curve.SubParts().Select(x => x.ToRevit() as Curve).ToList());
        }