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

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

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

            case Brep brep:
                return(ToGeometryObjectMany(BrepEncoder.ToRawBrep(brep, factor)).OfType <DB.GeometryObject>().ToArray());

            case Extrusion extrusion:
                return(ToGeometryObjectMany(ExtrusionEncoder.ToRawBrep(extrusion, factor)).OfType <DB.GeometryObject>().ToArray());

            case SubD subD:
                return(ToGeometryObjectMany(SubDEncoder.ToRawBrep(subD, factor)).OfType <DB.GeometryObject>().ToArray());;

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

            default:
                if (geometry.HasBrepForm)
                {
                    var brepForm = Brep.TryConvertBrep(geometry);
                    if (BrepEncoder.EncodeRaw(ref brepForm, factor))
                    {
                        return(ToGeometryObjectMany(brepForm).OfType <DB.GeometryObject>().ToArray());
                    }
                }

                return(new DB.GeometryObject[0]);
            }
        }
示例#2
0
 public static DB.Solid ToSolid(this Brep value, double factor) => BrepEncoder.ToSolid(BrepEncoder.ToRawBrep(value, factor));
示例#3
0
 public static DB.Solid ToSolid(this Brep value) => BrepEncoder.ToSolid(BrepEncoder.ToRawBrep(value, UnitConverter.ToHostUnits));