def __init__(self, x, y, z): super(Vertex, self).__init__() """Constructor for KbeVertex""" BaseObject.__init__(self, name='Vertex #{0}'.format(self._n)) self._n += 1 # should be a property of KbeObject self._pnt = gp_Pnt(x, y, z) self._vertex = make_vertex(self._pnt) TopoDS_Vertex.__init__(self, self._vertex)
def endpoints(self): """Get tuple of start and finish point of current curve object (if it exists).""" assert (self.is_wire_or_edge()) if self.is_wire(): a, b = TopoDS_Vertex(), TopoDS_Vertex() topexp.Vertices(self.Wire(), a, b) return point3(a), point3(b) elif self.is_edge(): a = topexp.FirstVertex(self.Edge()) b = topexp.LastVertex(self.Edge()) return point3(a), point3(b)
def common_vertex(edg1, edg2): from OCC.Core.TopExp import topexp_CommonVertex vert = TopoDS_Vertex() if topexp_CommonVertex(edg1, edg2, vert): return vert else: raise ValueError('no common vertex found')
def test_repr_for_null_TopoDS_Shape(self): # create null vertex and shape v = TopoDS_Vertex() self.assertTrue('Null' in v.__repr__()) s = TopoDS_Shape() self.assertTrue('Null' in s.__repr__())
def common_vertex(self, edge): vert = TopoDS_Vertex() if topexp.CommonVertex(self, edge, vert): return vert else: return False
def test_repr_for_null_topods_shapes(self): # create null vertex and shape v = TopoDS_Vertex() s = TopoDS_Shape() self.assertTrue('Null' in v.__repr__()) self.assertTrue('Null' in s.__repr__())