def _update(self): """ """ # TODO: perhaps should take an argument until which topological level # topological entities bound to the vertex should be updated too... reshape = ShapeBuild_ReShape() reshape.Replace(self._vertex, make_vertex(self._pnt))
def __init__(self, x,y,z): """Constructor for KbeVertex""" KbeObject.__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 __init__(self, x, y, z): """Constructor for KbeVertex""" KbeObject.__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 build_surface(self): ''' builds and renders the plate ''' self.plate = build_plate([self.poly], [self.pnt]) self.display.EraseAll() self.display.DisplayShape(self.plate) vert = make_vertex(self.pnt) self.display.DisplayShape(vert, update=True)
def geom_plate(event=None): display.EraseAll() p1,p2,p3,p4,p5 = gp_Pnt(0,0,0),gp_Pnt(0,10,0),gp_Pnt(0,10,10),gp_Pnt(0,0,10),gp_Pnt(5,5,5) poly = make_closed_polygon([p1,p2,p3,p4]) edges = [i for i in Topo(poly).edges()] face = make_n_sided(edges, [p5]) display.DisplayShape(edges) display.DisplayShape(make_vertex(p5)) display.DisplayShape(face, update=True)
def as_topods(self): '''returns a gp_Vec version of self''' return make_vertex(self)
display, start_display, add_menu, add_function_to_menu = init_display() print sys.argv[1] scaleFactor = 15 xReduceFactor = 35 yReduceFactor = 0 zReduceFactor = 50 dom = xml.dom.minidom.parse(sys.argv[1]) vertices = dom.getElementsByTagName('vertex') for vertex in vertices: x = int(vertex.attributes['x'].value) y = int(vertex.attributes['y'].value) z = int(vertex.attributes['z'].value) point = gp_Pnt((x-xReduceFactor)*scaleFactor,(y-yReduceFactor)*scaleFactor,(z-zReduceFactor)*scaleFactor) display.DisplayShape(make_vertex(point)) edges = dom.getElementsByTagName('edge') for edge in edges: x1 = int(edge.attributes['x1'].value) y1 = int(edge.attributes['y1'].value) z1 = int(edge.attributes['z1'].value) x2 = int(edge.attributes['x2'].value) y2 = int(edge.attributes['y2'].value) z2 = int(edge.attributes['z2'].value) segment = GC_MakeSegment(gp_Pnt((x1-xReduceFactor)*scaleFactor,(y1-yReduceFactor)*scaleFactor,(z1-zReduceFactor)*scaleFactor),gp_Pnt((x2-xReduceFactor)*scaleFactor,(y2-yReduceFactor)*scaleFactor,(z2-zReduceFactor)*scaleFactor)).Value() display.DisplayShape(make_edge(segment)) cylinders = dom.getElementsByTagName('cylinder') for cylinder in cylinders: x1 = int(cylinder.attributes['x1'].value) y1 = int(cylinder.attributes['y1'].value) z1 = int(cylinder.attributes['z1'].value)