예제 #1
0
 def __init__(self, p1, p2):
     # Build
     p1 = CheckGeom.to_point(p1)
     p2 = CheckGeom.to_point(p2)
     builder = BRepBuilderAPI_MakeEdge(p1, p2)
     self._e = Edge(builder.Edge())
     self._v1 = Vertex(builder.Vertex1())
     self._v2 = Vertex(builder.Vertex2())
예제 #2
0
    def __init__(self, pnt, other_shapes):
        pnt = CheckGeom.to_point(pnt)
        if not pnt:
            raise TypeError('Invalid point type provided.')

        v = Vertex.by_point(pnt)
        super(DistancePointToShapes, self).__init__(v, other_shapes)
예제 #3
0
    def __init__(self, *edges):
        # Build
        builder = BRepBuilderAPI_MakeWire()
        for e in edges:
            if e is not None and not e.is_null and e.is_edge:
                builder.Add(e.object)

        self._w = Wire(builder.Wire())
        self._last_e = Edge(builder.Edge())
        self._last_v = Vertex(builder.Vertex())
예제 #4
0
    def __init__(self, wire, face=None):
        if face is None:
            explorer = BRepTools_WireExplorer(wire.object)
        else:
            explorer = BRepTools_WireExplorer(wire.object, face.object)

        edges = []
        current_verts = []
        while explorer.More():
            ei = Edge(explorer.Current())
            vi = Vertex(explorer.CurrentVertex())
            edges.append(ei)
            current_verts.append(vi)
            explorer.Next()

        # CurrentVertex doesn't get the last vertex. Try to get it.
        ordered_verts = list(current_verts)
        if edges:
            vi = Vertex(explorer.CurrentVertex())
            ordered_verts.append(vi)

        self._edges = edges
        self._current_verts = current_verts
        self._ordered_verts = ordered_verts
예제 #5
0
 def __init__(self, pnt):
     self._v = Vertex.by_point(pnt)
예제 #6
0
 def __init__(self, vertex, v):
     v = CheckGeom.to_vector(v)
     builder = BRepPrimAPI_MakePrism(vertex.object, v)
     self._e = Edge(builder.Shape())
     self._v1 = Vertex(builder.FirstShape())
     self._v2 = Vertex(builder.LastShape())
예제 #7
0
 def __init__(self, crv):
     # Build
     builder = BRepBuilderAPI_MakeEdge(crv.object)
     self._e = Edge(builder.Edge())
     self._v1 = Vertex(builder.Vertex1())
     self._v2 = Vertex(builder.Vertex2())