diff --git a/Gui.py b/Gui.py index fd264eb..704c271 100644 --- a/Gui.py +++ b/Gui.py @@ -24,14 +24,14 @@ class Ui_fluencyCAD(object): def setupUi(self, fluencyCAD): if not fluencyCAD.objectName(): fluencyCAD.setObjectName(u"fluencyCAD") - fluencyCAD.resize(1755, 685) + fluencyCAD.resize(2214, 803) self.centralwidget = QWidget(fluencyCAD) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout.setObjectName(u"gridLayout") self.InputTab = QTabWidget(self.centralwidget) self.InputTab.setObjectName(u"InputTab") - sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.InputTab.sizePolicy().hasHeightForWidth()) @@ -79,61 +79,15 @@ class Ui_fluencyCAD(object): self.InputTab.addTab(self.code_tab, "") - self.gridLayout.addWidget(self.InputTab, 0, 2, 8, 1) - - self.groupBox = QGroupBox(self.centralwidget) - self.groupBox.setObjectName(u"groupBox") - self.gridLayout_3 = QGridLayout(self.groupBox) - self.gridLayout_3.setObjectName(u"gridLayout_3") - self.pb_extrdop = QPushButton(self.groupBox) - self.pb_extrdop.setObjectName(u"pb_extrdop") - - self.gridLayout_3.addWidget(self.pb_extrdop, 0, 0, 1, 1) - - self.pb_cutop = QPushButton(self.groupBox) - self.pb_cutop.setObjectName(u"pb_cutop") - - self.gridLayout_3.addWidget(self.pb_cutop, 0, 1, 1, 1) - - self.pb_arrayop = QPushButton(self.groupBox) - self.pb_arrayop.setObjectName(u"pb_arrayop") - - self.gridLayout_3.addWidget(self.pb_arrayop, 1, 0, 1, 1) - - self.pb_revop = QPushButton(self.groupBox) - self.pb_revop.setObjectName(u"pb_revop") - - self.gridLayout_3.addWidget(self.pb_revop, 1, 1, 1, 1) - - - self.gridLayout.addWidget(self.groupBox, 0, 5, 7, 1, Qt.AlignTop) - - self.gl_box = QGroupBox(self.centralwidget) - self.gl_box.setObjectName(u"gl_box") - sizePolicy1 = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) - sizePolicy1.setHorizontalStretch(0) - sizePolicy1.setVerticalStretch(4) - sizePolicy1.setHeightForWidth(self.gl_box.sizePolicy().hasHeightForWidth()) - self.gl_box.setSizePolicy(sizePolicy1) - font = QFont() - font.setPointSize(12) - self.gl_box.setFont(font) - self.horizontalLayout_4 = QHBoxLayout(self.gl_box) -#ifndef Q_OS_MAC - self.horizontalLayout_4.setSpacing(-1) -#endif - self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") - self.horizontalLayout_4.setContentsMargins(12, -1, -1, -1) - - self.gridLayout.addWidget(self.gl_box, 0, 4, 8, 1) + self.gridLayout.addWidget(self.InputTab, 0, 2, 11, 1) self.groupBox_5 = QGroupBox(self.centralwidget) self.groupBox_5.setObjectName(u"groupBox_5") - sizePolicy2 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) - sizePolicy2.setHorizontalStretch(0) - sizePolicy2.setVerticalStretch(0) - sizePolicy2.setHeightForWidth(self.groupBox_5.sizePolicy().hasHeightForWidth()) - self.groupBox_5.setSizePolicy(sizePolicy2) + sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + sizePolicy1.setHorizontalStretch(0) + sizePolicy1.setVerticalStretch(0) + sizePolicy1.setHeightForWidth(self.groupBox_5.sizePolicy().hasHeightForWidth()) + self.groupBox_5.setSizePolicy(sizePolicy1) self.groupBox_5.setMaximumSize(QSize(300, 16777215)) self.verticalLayout_3 = QVBoxLayout(self.groupBox_5) self.verticalLayout_3.setObjectName(u"verticalLayout_3") @@ -145,11 +99,11 @@ class Ui_fluencyCAD(object): self.groupBox_6 = QGroupBox(self.groupBox_5) self.groupBox_6.setObjectName(u"groupBox_6") - sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) - sizePolicy3.setHorizontalStretch(0) - sizePolicy3.setVerticalStretch(0) - sizePolicy3.setHeightForWidth(self.groupBox_6.sizePolicy().hasHeightForWidth()) - self.groupBox_6.setSizePolicy(sizePolicy3) + sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) + sizePolicy2.setHorizontalStretch(0) + sizePolicy2.setVerticalStretch(0) + sizePolicy2.setHeightForWidth(self.groupBox_6.sizePolicy().hasHeightForWidth()) + self.groupBox_6.setSizePolicy(sizePolicy2) self.gridLayout_6 = QGridLayout(self.groupBox_6) self.gridLayout_6.setObjectName(u"gridLayout_6") self.gridLayout_6.setContentsMargins(2, 2, 2, 2) @@ -179,8 +133,8 @@ class Ui_fluencyCAD(object): self.groupBox_8 = QGroupBox(self.groupBox_5) self.groupBox_8.setObjectName(u"groupBox_8") - sizePolicy3.setHeightForWidth(self.groupBox_8.sizePolicy().hasHeightForWidth()) - self.groupBox_8.setSizePolicy(sizePolicy3) + sizePolicy2.setHeightForWidth(self.groupBox_8.sizePolicy().hasHeightForWidth()) + self.groupBox_8.setSizePolicy(sizePolicy2) self.gridLayout_8 = QGridLayout(self.groupBox_8) self.gridLayout_8.setObjectName(u"gridLayout_8") self.gridLayout_8.setContentsMargins(2, 2, 2, 2) @@ -203,7 +157,7 @@ class Ui_fluencyCAD(object): self.verticalLayout_3.addWidget(self.groupBox_8) - self.gridLayout.addWidget(self.groupBox_5, 0, 3, 8, 1) + self.gridLayout.addWidget(self.groupBox_5, 0, 3, 11, 1) self.groupBox_4 = QGroupBox(self.centralwidget) self.groupBox_4.setObjectName(u"groupBox_4") @@ -215,7 +169,53 @@ class Ui_fluencyCAD(object): self.verticalLayout_2.addWidget(self.pushButton_2) - self.gridLayout.addWidget(self.groupBox_4, 7, 5, 1, 1) + self.gridLayout.addWidget(self.groupBox_4, 10, 5, 1, 1) + + self.gl_box = QGroupBox(self.centralwidget) + self.gl_box.setObjectName(u"gl_box") + sizePolicy3 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + sizePolicy3.setHorizontalStretch(0) + sizePolicy3.setVerticalStretch(4) + sizePolicy3.setHeightForWidth(self.gl_box.sizePolicy().hasHeightForWidth()) + self.gl_box.setSizePolicy(sizePolicy3) + font = QFont() + font.setPointSize(12) + self.gl_box.setFont(font) + self.horizontalLayout_4 = QHBoxLayout(self.gl_box) +#ifndef Q_OS_MAC + self.horizontalLayout_4.setSpacing(-1) +#endif + self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") + self.horizontalLayout_4.setContentsMargins(12, -1, -1, -1) + + self.gridLayout.addWidget(self.gl_box, 0, 4, 11, 1) + + self.groupBox = QGroupBox(self.centralwidget) + self.groupBox.setObjectName(u"groupBox") + self.gridLayout_3 = QGridLayout(self.groupBox) + self.gridLayout_3.setObjectName(u"gridLayout_3") + self.pb_extrdop = QPushButton(self.groupBox) + self.pb_extrdop.setObjectName(u"pb_extrdop") + + self.gridLayout_3.addWidget(self.pb_extrdop, 0, 0, 1, 1) + + self.pb_cutop = QPushButton(self.groupBox) + self.pb_cutop.setObjectName(u"pb_cutop") + + self.gridLayout_3.addWidget(self.pb_cutop, 0, 1, 1, 1) + + self.pb_arrayop = QPushButton(self.groupBox) + self.pb_arrayop.setObjectName(u"pb_arrayop") + + self.gridLayout_3.addWidget(self.pb_arrayop, 1, 0, 1, 1) + + self.pb_revop = QPushButton(self.groupBox) + self.pb_revop.setObjectName(u"pb_revop") + + self.gridLayout_3.addWidget(self.pb_revop, 1, 1, 1, 1) + + + self.gridLayout.addWidget(self.groupBox, 0, 5, 10, 1, Qt.AlignTop) self.groupBox_9 = QGroupBox(self.centralwidget) self.groupBox_9.setObjectName(u"groupBox_9") @@ -236,8 +236,8 @@ class Ui_fluencyCAD(object): self.groupBox_2 = QGroupBox(self.centralwidget) self.groupBox_2.setObjectName(u"groupBox_2") - sizePolicy3.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) - self.groupBox_2.setSizePolicy(sizePolicy3) + sizePolicy2.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) + self.groupBox_2.setSizePolicy(sizePolicy2) self.gridLayout_2 = QGridLayout(self.groupBox_2) self.gridLayout_2.setObjectName(u"gridLayout_2") self.pb_rectool = QPushButton(self.groupBox_2) @@ -273,8 +273,9 @@ class Ui_fluencyCAD(object): self.groupBox_3 = QGroupBox(self.centralwidget) self.groupBox_3.setObjectName(u"groupBox_3") - sizePolicy3.setHeightForWidth(self.groupBox_3.sizePolicy().hasHeightForWidth()) - self.groupBox_3.setSizePolicy(sizePolicy3) + sizePolicy2.setHeightForWidth(self.groupBox_3.sizePolicy().hasHeightForWidth()) + self.groupBox_3.setSizePolicy(sizePolicy2) + self.groupBox_3.setMaximumSize(QSize(16777214, 16777213)) self.gridLayout_4 = QGridLayout(self.groupBox_3) self.gridLayout_4.setObjectName(u"gridLayout_4") self.pb_con_line = QPushButton(self.groupBox_3) @@ -296,14 +297,21 @@ class Ui_fluencyCAD(object): self.pb_con_horiz.setCheckable(True) self.pb_con_horiz.setAutoExclusive(False) - self.gridLayout_4.addWidget(self.pb_con_horiz, 1, 0, 1, 1) + self.gridLayout_4.addWidget(self.pb_con_horiz, 2, 0, 1, 1) self.pb_con_vert = QPushButton(self.groupBox_3) self.pb_con_vert.setObjectName(u"pb_con_vert") self.pb_con_vert.setCheckable(True) self.pb_con_vert.setAutoExclusive(False) - self.gridLayout_4.addWidget(self.pb_con_vert, 1, 1, 1, 1) + self.gridLayout_4.addWidget(self.pb_con_vert, 2, 1, 1, 1) + + self.pb_con_sym = QPushButton(self.groupBox_3) + self.pb_con_sym.setObjectName(u"pb_con_sym") + self.pb_con_sym.setCheckable(True) + self.pb_con_sym.setAutoExclusive(False) + + self.gridLayout_4.addWidget(self.pb_con_sym, 3, 1, 1, 1) self.pb_con_dist = QPushButton(self.groupBox_3) self.pb_con_dist.setObjectName(u"pb_con_dist") @@ -311,14 +319,19 @@ class Ui_fluencyCAD(object): self.pb_con_dist.setAutoExclusive(False) self.pb_con_dist.setAutoRepeatDelay(297) - self.gridLayout_4.addWidget(self.pb_con_dist, 2, 0, 1, 1) + self.gridLayout_4.addWidget(self.pb_con_dist, 3, 0, 1, 1) - self.pb_con_sym = QPushButton(self.groupBox_3) - self.pb_con_sym.setObjectName(u"pb_con_sym") - self.pb_con_sym.setCheckable(True) - self.pb_con_sym.setAutoExclusive(False) + self.pb_con_mid = QPushButton(self.groupBox_3) + self.pb_con_mid.setObjectName(u"pb_con_mid") + self.pb_con_mid.setCheckable(True) - self.gridLayout_4.addWidget(self.pb_con_sym, 2, 1, 1, 1) + self.gridLayout_4.addWidget(self.pb_con_mid, 1, 0, 1, 1) + + self.pb_con_perp = QPushButton(self.groupBox_3) + self.pb_con_perp.setObjectName(u"pb_con_perp") + self.pb_con_perp.setCheckable(True) + + self.gridLayout_4.addWidget(self.pb_con_perp, 1, 1, 1, 1) self.gridLayout.addWidget(self.groupBox_3, 2, 0, 1, 1) @@ -326,7 +339,7 @@ class Ui_fluencyCAD(object): fluencyCAD.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(fluencyCAD) self.menubar.setObjectName(u"menubar") - self.menubar.setGeometry(QRect(0, 0, 1755, 24)) + self.menubar.setGeometry(QRect(0, 0, 2214, 24)) fluencyCAD.setMenuBar(self.menubar) self.statusbar = QStatusBar(fluencyCAD) self.statusbar.setObjectName(u"statusbar") @@ -349,12 +362,6 @@ class Ui_fluencyCAD(object): self.pb_apply_code.setText(QCoreApplication.translate("fluencyCAD", u"Apply Code", None)) self.pushButton.setText(QCoreApplication.translate("fluencyCAD", u"Delete Code", None)) self.InputTab.setTabText(self.InputTab.indexOf(self.code_tab), QCoreApplication.translate("fluencyCAD", u"Code", None)) - self.groupBox.setTitle(QCoreApplication.translate("fluencyCAD", u"Modify", None)) - self.pb_extrdop.setText(QCoreApplication.translate("fluencyCAD", u"Extrd", None)) - self.pb_cutop.setText(QCoreApplication.translate("fluencyCAD", u"Cut", None)) - self.pb_arrayop.setText(QCoreApplication.translate("fluencyCAD", u"Arry", None)) - self.pb_revop.setText(QCoreApplication.translate("fluencyCAD", u"Rev", None)) - self.gl_box.setTitle(QCoreApplication.translate("fluencyCAD", u"Model Viewer", None)) self.groupBox_5.setTitle(QCoreApplication.translate("fluencyCAD", u"Sketch", None)) self.groupBox_6.setTitle(QCoreApplication.translate("fluencyCAD", u"Tools", None)) self.pb_del_sketch.setText(QCoreApplication.translate("fluencyCAD", u"Del sketch", None)) @@ -366,6 +373,12 @@ class Ui_fluencyCAD(object): self.pb_edt_sktch_3.setText(QCoreApplication.translate("fluencyCAD", u"Nothing", None)) self.groupBox_4.setTitle(QCoreApplication.translate("fluencyCAD", u"Export", None)) self.pushButton_2.setText(QCoreApplication.translate("fluencyCAD", u"STL", None)) + self.gl_box.setTitle(QCoreApplication.translate("fluencyCAD", u"Model Viewer", None)) + self.groupBox.setTitle(QCoreApplication.translate("fluencyCAD", u"Modify", None)) + self.pb_extrdop.setText(QCoreApplication.translate("fluencyCAD", u"Extrd", None)) + self.pb_cutop.setText(QCoreApplication.translate("fluencyCAD", u"Cut", None)) + self.pb_arrayop.setText(QCoreApplication.translate("fluencyCAD", u"Arry", None)) + self.pb_revop.setText(QCoreApplication.translate("fluencyCAD", u"Rev", None)) self.groupBox_9.setTitle(QCoreApplication.translate("fluencyCAD", u"Workplanes", None)) self.pb_origin_wp.setText(QCoreApplication.translate("fluencyCAD", u"WP Origin", None)) self.pb_origin_face.setText(QCoreApplication.translate("fluencyCAD", u" WP Face", None)) @@ -375,11 +388,13 @@ class Ui_fluencyCAD(object): self.pb_slotool.setText(QCoreApplication.translate("fluencyCAD", u"Slot", None)) self.pb_linetool.setText(QCoreApplication.translate("fluencyCAD", u"Line", None)) self.groupBox_3.setTitle(QCoreApplication.translate("fluencyCAD", u"Constrain", None)) - self.pb_con_line.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Line", None)) + self.pb_con_line.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Lne", None)) self.pb_con_ptpt.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Pt", None)) self.pb_con_horiz.setText(QCoreApplication.translate("fluencyCAD", u"Horiz", None)) self.pb_con_vert.setText(QCoreApplication.translate("fluencyCAD", u"Vert", None)) - self.pb_con_dist.setText(QCoreApplication.translate("fluencyCAD", u"Distnce", None)) self.pb_con_sym.setText(QCoreApplication.translate("fluencyCAD", u"Symetrc", None)) + self.pb_con_dist.setText(QCoreApplication.translate("fluencyCAD", u"Distnce", None)) + self.pb_con_mid.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Mid_L", None)) + self.pb_con_perp.setText(QCoreApplication.translate("fluencyCAD", u"Perp_Lne", None)) # retranslateUi diff --git a/drawing_modules/draw_widget2d.py b/drawing_modules/draw_widget2d.py index e9fcc96..55c5502 100644 --- a/drawing_modules/draw_widget2d.py +++ b/drawing_modules/draw_widget2d.py @@ -72,6 +72,11 @@ class SketchWidget(QWidget): def distance(self, p1, p2): return math.sqrt((p1.x() - p2.x())**2 + (p1.y() - p2.y())**2) + def calculate_midpoint(self, point1, point2): + mx = (point1.x() + point2.x()) // 2 + my = (point1.y() + point2.y()) // 2 + return QPoint(mx, my) + def is_point_on_line(self, p, p1, p2, tolerance=5): # Calculate the lengths of the sides of the triangle a = self.distance(p, p1) @@ -137,18 +142,19 @@ class SketchWidget(QWidget): """print("Initial slv_points_main:", self.slv_points_main) print("Change list:", point_list)""" - for tbu_points_idx in point_list: - # Each tbu_points_idx is a tuple: (index, old_point, new_point) - index, old_point, new_point = tbu_points_idx - """print("Updating index:", index) - print("Old point:", old_point) - print("New point:", new_point)""" + if len(point_list) > 0: + for tbu_points_idx in point_list: + # Each tbu_points_idx is a tuple: (index, old_point, new_point) + index, old_point, new_point = tbu_points_idx + """print("Updating index:", index) + print("Old point:", old_point) + print("New point:", new_point)""" - # Update the point in slv_points_main - self.slv_points_main[index]['ui_point'] = new_point + # Update the point in slv_points_main + self.slv_points_main[index]['ui_point'] = new_point - # Print updated state - #print("Updated slv_points_main:", self.slv_points_main) + # Print updated state + #print("Updated slv_points_main:", self.slv_points_main) """# UPDATE UI POINTS with solver points for i in range(len(self.slv_points_main) + len(self.slv_lines_main)): @@ -436,6 +442,9 @@ class SketchWidget(QWidget): elif self.solv.solve() == ResultFlag.INCONSISTENT: print("Solve_failed - Incons") + if event.button() == Qt.LeftButton and self.mouse_mode == "pb_con_mid": + + points_need_update = check_all_points() print("This", points_need_update) @@ -514,19 +523,21 @@ class SketchWidget(QWidget): painter.drawLine(middle_x, 0, middle_x, self.height()) # Draw tick marks - tick_length = 10 - tick_spacing = 50 + tick_length = int(10 * self.zoom) + tick_spacing = int(50 * self.zoom) pen = QPen(Qt.gray, 1, Qt.SolidLine) painter.setPen(pen) - # Draw tick marks on the X axis - for x in range(0, self.width(), tick_spacing): - painter.drawLine(x, middle_y - tick_length // 2, x, middle_y + tick_length // 2) + # Draw tick marks on the X axis to the right and left from the middle point + for x in range(0, self.width() // 2, tick_spacing): + painter.drawLine(middle_x + x, middle_y - tick_length // 2, middle_x + x, middle_y + tick_length // 2) + painter.drawLine(middle_x - x, middle_y - tick_length // 2, middle_x - x, middle_y + tick_length // 2) - # Draw tick marks on the Y axis - for y in range(0, self.height(), tick_spacing): - painter.drawLine(middle_x - tick_length // 2, y, middle_x + tick_length // 2, y) + # Draw tick marks on the Y axis upwards and downwards from the middle point + for y in range(0, self.height() // 2, tick_spacing): + painter.drawLine(middle_x - tick_length // 2, middle_y + y, middle_x + tick_length // 2, middle_y + y) + painter.drawLine(middle_x - tick_length // 2, middle_y - y, middle_x + tick_length // 2, middle_y - y) # Draw the origin point in red painter.setPen(QPen(Qt.red, 4)) @@ -553,11 +564,6 @@ class SketchWidget(QWidget): # Apply the zoom factor painter.scale(self.zoom, self.zoom) - # Set the background color - #painter.fillRect(0, self.width(), 0, self.height(), QColor('black')) - - # Draw axes - pen = QPen(Qt.gray) pen.setWidth(2 / self.zoom) painter.setPen(pen) @@ -567,7 +573,14 @@ class SketchWidget(QWidget): painter.drawEllipse(point['ui_point'], 3 / self.zoom, 3 / self.zoom) for dic in self.slv_lines_main: - painter.drawLine(dic['ui_points'][0] , dic['ui_points'][1]) + p1 = dic['ui_points'][0] + p2 = dic['ui_points'][1] + painter.drawLine(p1, p2) + + dis = self.distance(p1, p2) + mid = self.calculate_midpoint(p1, p2) + + painter.drawText(mid, str(round(dis, 2))) pen = QPen(Qt.green) pen.setWidth(2) @@ -587,7 +600,7 @@ class SketchWidget(QWidget): painter.setPen(highlight_pen) painter.drawEllipse(self.hovered_point, 5 / self.zoom, 5 / self.zoom) - if self.selected_line: + if self.selected_line and not self.hovered_point: p1, p2 = self.selected_line painter.setPen(QPen(Qt.red, 2)) painter.drawLine(p1, p2) diff --git a/gui.ui b/gui.ui index 417e23d..c056d4b 100644 --- a/gui.ui +++ b/gui.ui @@ -6,8 +6,8 @@ 0 0 - 1755 - 685 + 2214 + 803 @@ -15,10 +15,10 @@ - + - + 0 0 @@ -81,70 +81,7 @@ - - - - Modify - - - - - - Extrd - - - - - - - Cut - - - - - - - Arry - - - - - - - Rev - - - - - - - - - - - 0 - 4 - - - - - 12 - - - - Model Viewer - - - - -1 - - - 12 - - - - - + @@ -275,7 +212,7 @@ - + Export @@ -291,6 +228,69 @@ + + + + + 0 + 4 + + + + + 12 + + + + Model Viewer + + + + -1 + + + 12 + + + + + + + + Modify + + + + + + Extrd + + + + + + + Cut + + + + + + + Arry + + + + + + + Rev + + + + + + @@ -389,6 +389,12 @@ 0 + + + 16777214 + 16777213 + + Constrain @@ -396,7 +402,7 @@ - Pt_Line + Pt_Lne true @@ -419,7 +425,7 @@ - + Horiz @@ -432,7 +438,7 @@ - + Vert @@ -445,7 +451,20 @@ - + + + + Symetrc + + + true + + + false + + + + Distnce @@ -461,16 +480,23 @@ - - + + - Symetrc + Pt_Mid_L true - - false + + + + + + Perp_Lne + + + true @@ -484,7 +510,7 @@ 0 0 - 1755 + 2214 24 diff --git a/main.py b/main.py index 9d66abc..63c3d0e 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,6 @@ from python_solvespace import SolverSystem, ResultFlag # main, draw_widget, gl_widget class MainWindow(QMainWindow): - def __init__(self): super().__init__() @@ -65,7 +64,6 @@ class MainWindow(QMainWindow): self.sketchWidget.constrain_done.connect(self.constrain_finished) - def add_wp_origin(self): #Select orientation #orientation, ok = Q .getDouble(self, 'Extrude Length', 'Enter a mm value:', decimals=2) @@ -88,7 +86,7 @@ class MainWindow(QMainWindow): self.sketchWidget.line_buffer = None def act_constrain_pt_line_mode(self): - if not self.ui.pb_linetool.isChecked(): + if not self.ui.pb_con_line.isChecked(): self.sketchWidget.mouse_mode = 'pt_line' else: self.sketchWidget.mouse_mode = None @@ -109,12 +107,19 @@ class MainWindow(QMainWindow): self.sketchWidget.line_buffer = None def act_constrain_distance_mode(self): - if not self.ui.pb_con_vert.isChecked(): + if not self.ui.pb_con_dist.isChecked(): self.sketchWidget.mouse_mode = 'distance' else: self.sketchWidget.mouse_mode = None self.sketchWidget.line_buffer = None + def act_constrain_mid_point_mode(self): + if not self.ui.pb_con_mid.isChecked(): + self.sketchWidget.mouse_mode = 'pb_con_mid' + else: + self.sketchWidget.mouse_mode = None + self.sketchWidget.line_buffer = None + def constrain_finished(self): self.ui.pb_con_ptpt.setChecked(False) self.ui.pb_con_line.setChecked(False) @@ -225,7 +230,6 @@ class MainWindow(QMainWindow): return p_list - def send_extrude(self): selected = self.ui.sketch_list.currentItem() name = selected.text() @@ -289,10 +293,6 @@ class MainWindow(QMainWindow): self.openGLWidget.load_stl(file) self.openGLWidget.update() - - - - """ def check_current_tab(self): if self.ui.InputTab.currentIndex() == 0: geo = Geometry()