def show_vectors(self): if self.parent.control.program.vectors.__len__() > 0: Vector.iso_projection() matrix = Vector.process_to_matrix(self.parent.control.program.vectors) self.plot.updateData(matrix[:, 0], matrix[:, 1], connect="pairs") else: self.plot.setData([], [])
def set_up(self): self.setGeometry(300, 300, 800, 600) self.keyPressed.connect(self.on_key) self.view.scene().sigMouseMoved.connect(self._cursor) self.view.scene().sigMouseClicked.connect(self.check_point) self.show() self.set_viewbox() Vector.iso_projection() self.plot()
def open_dxf(self): try: file = qfd.getOpenFileName(self, "Open DXF", "c:\\", "dfx files (*.dxf)") self.all_vectors = read_dxf(file[0]) self.matrix_plot = np.array(reduce(add, [[vector.start, vector.end] for vector in self.all_vectors])) Vector.default_position() Vector.iso_projection() self.plot() except: return
def rotation(self, direction): if direction == QtCore.Qt.Key_Up: Vector.alpha += 0.1 elif direction == QtCore.Qt.Key_Down: Vector.alpha -= 0.1 elif direction == QtCore.Qt.Key_Left: Vector.beta -= 0.1 elif direction == QtCore.Qt.Key_Right: Vector.beta += 0.1 Vector.iso_projection() self.show_vectors() self.show_vector_selection() self.show_points() self.graphics.autoRange(items=[self.plot])
def atm_rot(self, direction): if direction == QtCore.Qt.Key_Up: Vector.alpha += 0.1 elif direction == QtCore.Qt.Key_Down: Vector.alpha -= 0.1 elif direction == QtCore.Qt.Key_Left: Vector.beta -= 0.1 elif direction == QtCore.Qt.Key_Right: Vector.beta += 0.1 Vector.iso_projection() self.plot() self.plot_select()
def clear_all(self): self.all_vectors = [] self.vector_set = set([]) Vector.iso_projection() self.plot() self.plot_select()