public static void DumpShapeInfo(ILog log, TopoDSShape shape) { log.Info("--- Shape Info ---"); var vertexes = GeomUtils.ExtractVertexes(shape); log.InfoFormat("Extracted {0} vertexes", vertexes.Count); foreach (var vertex in vertexes) { var pnt = BRepTool.Pnt(vertex); log.InfoFormat("vertex: {0},{1},{2}", pnt.X, pnt.Y, pnt.Z); } var edges = GeomUtils.ExtractEdges(shape); log.InfoFormat("Extracted {0} edges", edges.Count); var wires = GeomUtils.ExtractWires(shape); log.InfoFormat("Extracted {0} wires", wires.Count); var faces = GeomUtils.ExtractFaces(shape); log.InfoFormat("Extracted {0} faces", faces.Count); log.Info("-------------------"); }
private static bool EdgesAreIdentical(TopoDSEdge edge1, TopoDSEdge edge2) { var pointsEdge1 = GeomUtils.ExtractVertexes(edge1); var pointsEdge2 = GeomUtils.ExtractVertexes(edge2); if (pointsEdge1.Count != 2 || pointsEdge2.Count != 2) { return(false); } var p11 = new Point3D(BRepTool.Pnt(pointsEdge1[0])); var p12 = new Point3D(BRepTool.Pnt(pointsEdge1[1])); var p21 = new Point3D(BRepTool.Pnt(pointsEdge2[0])); var p22 = new Point3D(BRepTool.Pnt(pointsEdge2[1])); if (p11.IsEqual(p21) && p12.IsEqual(p22)) { return(true); } if (p12.IsEqual(p21) && p11.IsEqual(p22)) { return(true); } return(false); }
public static gpPnt ConvertShapeToPoint(TopoDSShape shape) { return(shape == null ? null : BRepTool.Pnt(TopoDS.Vertex(shape))); }