public static Spatial.Shell ToSAM(this global::Topologic.Shell shell) { if (shell == null) { return(null); } IList <global::Topologic.Face> faces = shell.Faces; if (faces == null || faces.Count == 0) { return(null); } List <Face3D> face3Ds = new List <Face3D>(); foreach (global::Topologic.Face face in faces) { Face3D face3D = face.ToSAM(); if (face3D == null) { continue; } face3Ds.Add(face3D); } return(new Spatial.Shell(face3Ds)); }
public static global::Topologic.Shell ToTopologic(this Spatial.Shell shell, double tolerance = Core.Tolerance.Distance) { List <Face3D> face3Ds = shell?.Face3Ds; if (face3Ds == null || face3Ds.Count == 0) { return(null); } global::Topologic.Shell result = global::Topologic.Shell.ByFaces(face3Ds.ConvertAll(x => x.ToTopologic()), tolerance); return(result); }
internal static PolySurface PolySurface(global::Topologic.Shell shell) { List <global::Topologic.Face> faces = shell.Faces; List <ISurface> bhomSurfaces = new List <ISurface>(); foreach (global::Topologic.Face face in faces) { bhomSurfaces.Add(Convert.PlanarSurface(face)); } return(new PolySurface { Surfaces = bhomSurfaces }); }
public static Cell ToTopologic_Cell(this Spatial.Shell shell, double tolerance = Core.Tolerance.Distance) { List <Face3D> face3Ds = shell?.Face3Ds; if (face3Ds == null || face3Ds.Count == 0) { return(null); } Cell result = null; try { result = Cell.ByFaces(face3Ds.ConvertAll(x => x.ToTopologic()), tolerance); } catch { result = null; } if (result != null) { return(result); } global::Topologic.Shell shell_Topologic = shell.ToTopologic(tolerance); if (shell_Topologic == null) { return(result); } try { result = Cell.ByShell(shell_Topologic); } catch { result = null; } return(result); }
private static global::Topologic.Topology TopologyByMesh(Mesh bhomMesh) { global::Topologic.Shell shell = Create.ShellByMesh(bhomMesh); if (shell == null) { return(null); } List <global::Topologic.Face> faces = shell.Faces; if (faces.Count == 0) { return(null); } else if (faces.Count == 1) { return(faces[0]); } // else return(shell); }
public static Topology ToTopologic(this Brep brep, double tolerance = Core.Tolerance.Distance) { if (brep == null) { return(null); } BrepFaceList ghBrepFaces = brep.Faces; List <global::Topologic.Face> faces = new List <global::Topologic.Face>(); foreach (BrepFace ghBrepFace in ghBrepFaces) { global::Topologic.Face face = ghBrepFace.ToTopologic(); faces.Add(face); } if (faces.Count == 0) { return(null); } else if (faces.Count == 1) { return(faces[0]); } else { global::Topologic.Shell shell = global::Topologic.Shell.ByFaces(faces, tolerance); if (brep.IsSolid) { Cell cell = Cell.ByShell(shell); return(cell); } return(shell); } }
internal static IGeometry BasicGeometry(global::Topologic.Topology topology) { if (topology == null) { return(null); } global::Topologic.Vertex vertex = topology as global::Topologic.Vertex; if (vertex != null) { return(Convert.BasicGeometry(vertex)); } global::Topologic.Edge edge = topology as global::Topologic.Edge; if (edge != null) { return(Convert.BasicGeometry(edge)); } global::Topologic.Wire wire = topology as global::Topologic.Wire; if (wire != null) { return(Convert.BasicGeometry(wire)); } global::Topologic.Face face = topology as global::Topologic.Face; if (face != null) { return(Convert.BasicGeometry(face)); } global::Topologic.Shell shell = topology as global::Topologic.Shell; if (shell != null) { return(Convert.BasicGeometry(shell)); } global::Topologic.Cell cell = topology as global::Topologic.Cell; if (cell != null) { return(Convert.BasicGeometry(cell)); } global::Topologic.CellComplex cellComplex = topology as global::Topologic.CellComplex; if (cellComplex != null) { return(Convert.BasicGeometry(cellComplex)); } global::Topologic.Cluster cluster = topology as global::Topologic.Cluster; if (cluster != null) { return(Convert.BasicGeometry(cluster)); } //global::Topologic.Aperture aperture = topology as global::Topologic.Aperture; //if (aperture != null) //{ // return Aperture.Convert.BasicGeometry(aperture); //} throw new NotImplementedException("Geometry for this shape is not supported yet"); }
public static List <global::Topologic.Vertex> Vertices(global::Topologic.Shell shell) { return(shell.Vertices); }
public static bool IsClosed(global::Topologic.Shell shell) { return(shell.IsClosed); }
public static List <global::Topologic.Edge> Edges(global::Topologic.Shell shell) { return(shell.Edges); }
public static List <global::Topologic.Wire> Wires(global::Topologic.Shell shell) { return(shell.Wires); }
public static List <global::Topologic.Face> Faces(global::Topologic.Shell shell) { return(shell.Faces); }
public static List <global::Topologic.Cell> Cells(global::Topologic.Shell shell) { return(shell.Cells); }
internal static IGeometry BasicGeometry(global::Topologic.Shell shell) { return(PolySurface(shell)); }
public static global::Topologic.Cell CellByShell(global::Topologic.Shell shell) { return(global::Topologic.Cell.ByShell(shell)); }