public static DB.GeometryObject[] ToShape(this GeometryBase geometry, double factor)
        {
            switch (geometry)
            {
            case Point point:
                return(new DB.Point[] { point.ToPoint(factor) });

            case PointCloud pointCloud:
                return(pointCloud.ToPoints(factor));

            case Curve curve:
                return(curve.ToCurveMany(factor).SelectMany(x => x.ToBoundedCurves()).ToArray());

            case Brep brep:
                return(new DB.GeometryObject[] { ToShape(brep, factor) });

            case Extrusion extrusion:
                return(new DB.GeometryObject[] { ToShape(extrusion, factor) });

            case SubD subD:
                return(new DB.GeometryObject[] { ToShape(subD, factor) });

            case Mesh mesh:
                return(new DB.GeometryObject[] { MeshEncoder.ToMesh(MeshEncoder.ToRawMesh(mesh, factor)) });

            default:
                if (geometry.HasBrepForm)
                {
                    var brepForm = Brep.TryConvertBrep(geometry);
                    return(new DB.GeometryObject[] { ToShape(brepForm, factor) });
                }

                return(new DB.GeometryObject[0]);
            }
        }
Example #2
0
 public static DB.Mesh ToMesh(this Mesh value, double factor) => MeshEncoder.ToMesh(MeshEncoder.ToRawMesh(value, factor));
Example #3
0
 public static DB.Mesh ToMesh(this Mesh value) => MeshEncoder.ToMesh(MeshEncoder.ToRawMesh(value, UnitConverter.ToHostUnits));
Example #4
0
 public static DB.Solid ToSolid(this Mesh value, double factor) => BrepEncoder.ToSolid(MeshEncoder.ToRawBrep(value, factor));
Example #5
0
 public static DB.Solid ToSolid(this Mesh value) => Raw.RawEncoder.ToHost(MeshEncoder.ToRawBrep(value, UnitConverter.ToHostUnits));