- Sketch projection and extrude in place working
This commit is contained in:
parent
d2b8d9540a
commit
0c3e4eeb5e
425
Gui.py
425
Gui.py
@ -29,65 +29,50 @@ class Ui_fluencyCAD(object):
|
|||||||
self.centralwidget.setObjectName(u"centralwidget")
|
self.centralwidget.setObjectName(u"centralwidget")
|
||||||
self.gridLayout = QGridLayout(self.centralwidget)
|
self.gridLayout = QGridLayout(self.centralwidget)
|
||||||
self.gridLayout.setObjectName(u"gridLayout")
|
self.gridLayout.setObjectName(u"gridLayout")
|
||||||
self.InputTab = QTabWidget(self.centralwidget)
|
self.groupBox = QGroupBox(self.centralwidget)
|
||||||
self.InputTab.setObjectName(u"InputTab")
|
self.groupBox.setObjectName(u"groupBox")
|
||||||
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
|
self.gridLayout_3 = QGridLayout(self.groupBox)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
self.gridLayout_3.setObjectName(u"gridLayout_3")
|
||||||
sizePolicy.setVerticalStretch(0)
|
self.pb_revop = QPushButton(self.groupBox)
|
||||||
sizePolicy.setHeightForWidth(self.InputTab.sizePolicy().hasHeightForWidth())
|
self.pb_revop.setObjectName(u"pb_revop")
|
||||||
self.InputTab.setSizePolicy(sizePolicy)
|
|
||||||
self.sketch_tab = QWidget()
|
|
||||||
self.sketch_tab.setObjectName(u"sketch_tab")
|
|
||||||
self.verticalLayout_4 = QVBoxLayout(self.sketch_tab)
|
|
||||||
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
|
|
||||||
self.InputTab.addTab(self.sketch_tab, "")
|
|
||||||
self.code_tab = QWidget()
|
|
||||||
self.code_tab.setObjectName(u"code_tab")
|
|
||||||
self.verticalLayout = QVBoxLayout(self.code_tab)
|
|
||||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
|
||||||
self.textEdit = QTextEdit(self.code_tab)
|
|
||||||
self.textEdit.setObjectName(u"textEdit")
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.textEdit)
|
self.gridLayout_3.addWidget(self.pb_revop, 2, 1, 1, 1)
|
||||||
|
|
||||||
self.groupBox_7 = QGroupBox(self.code_tab)
|
self.pb_extrdop = QPushButton(self.groupBox)
|
||||||
self.groupBox_7.setObjectName(u"groupBox_7")
|
self.pb_extrdop.setObjectName(u"pb_extrdop")
|
||||||
self.gridLayout_5 = QGridLayout(self.groupBox_7)
|
|
||||||
self.gridLayout_5.setObjectName(u"gridLayout_5")
|
|
||||||
self.pushButton_5 = QPushButton(self.groupBox_7)
|
|
||||||
self.pushButton_5.setObjectName(u"pushButton_5")
|
|
||||||
|
|
||||||
self.gridLayout_5.addWidget(self.pushButton_5, 2, 0, 1, 1)
|
self.gridLayout_3.addWidget(self.pb_extrdop, 0, 0, 1, 1)
|
||||||
|
|
||||||
self.pushButton_4 = QPushButton(self.groupBox_7)
|
self.pb_arrayop = QPushButton(self.groupBox)
|
||||||
self.pushButton_4.setObjectName(u"pushButton_4")
|
self.pb_arrayop.setObjectName(u"pb_arrayop")
|
||||||
|
|
||||||
self.gridLayout_5.addWidget(self.pushButton_4, 2, 1, 1, 1)
|
self.gridLayout_3.addWidget(self.pb_arrayop, 2, 0, 1, 1)
|
||||||
|
|
||||||
self.pb_apply_code = QPushButton(self.groupBox_7)
|
self.pb_cutop = QPushButton(self.groupBox)
|
||||||
self.pb_apply_code.setObjectName(u"pb_apply_code")
|
self.pb_cutop.setObjectName(u"pb_cutop")
|
||||||
|
|
||||||
self.gridLayout_5.addWidget(self.pb_apply_code, 1, 0, 1, 1)
|
self.gridLayout_3.addWidget(self.pb_cutop, 0, 1, 1, 1)
|
||||||
|
|
||||||
self.pushButton = QPushButton(self.groupBox_7)
|
self.pb_combop = QPushButton(self.groupBox)
|
||||||
self.pushButton.setObjectName(u"pushButton")
|
self.pb_combop.setObjectName(u"pb_combop")
|
||||||
|
|
||||||
self.gridLayout_5.addWidget(self.pushButton, 1, 1, 1, 1)
|
self.gridLayout_3.addWidget(self.pb_combop, 1, 0, 1, 1)
|
||||||
|
|
||||||
|
self.pb_moveop = QPushButton(self.groupBox)
|
||||||
|
self.pb_moveop.setObjectName(u"pb_moveop")
|
||||||
|
|
||||||
|
self.gridLayout_3.addWidget(self.pb_moveop, 1, 1, 1, 1)
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.groupBox_7)
|
self.gridLayout.addWidget(self.groupBox, 0, 5, 10, 1, Qt.AlignTop)
|
||||||
|
|
||||||
self.InputTab.addTab(self.code_tab, "")
|
|
||||||
|
|
||||||
self.gridLayout.addWidget(self.InputTab, 0, 2, 11, 1)
|
|
||||||
|
|
||||||
self.groupBox_5 = QGroupBox(self.centralwidget)
|
self.groupBox_5 = QGroupBox(self.centralwidget)
|
||||||
self.groupBox_5.setObjectName(u"groupBox_5")
|
self.groupBox_5.setObjectName(u"groupBox_5")
|
||||||
sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||||
sizePolicy1.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy1.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy1.setHeightForWidth(self.groupBox_5.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.groupBox_5.sizePolicy().hasHeightForWidth())
|
||||||
self.groupBox_5.setSizePolicy(sizePolicy1)
|
self.groupBox_5.setSizePolicy(sizePolicy)
|
||||||
self.groupBox_5.setMaximumSize(QSize(300, 16777215))
|
self.groupBox_5.setMaximumSize(QSize(300, 16777215))
|
||||||
self.verticalLayout_3 = QVBoxLayout(self.groupBox_5)
|
self.verticalLayout_3 = QVBoxLayout(self.groupBox_5)
|
||||||
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
||||||
@ -99,11 +84,11 @@ class Ui_fluencyCAD(object):
|
|||||||
|
|
||||||
self.groupBox_6 = QGroupBox(self.groupBox_5)
|
self.groupBox_6 = QGroupBox(self.groupBox_5)
|
||||||
self.groupBox_6.setObjectName(u"groupBox_6")
|
self.groupBox_6.setObjectName(u"groupBox_6")
|
||||||
sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
|
sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
|
||||||
sizePolicy2.setHorizontalStretch(0)
|
sizePolicy1.setHorizontalStretch(0)
|
||||||
sizePolicy2.setVerticalStretch(0)
|
sizePolicy1.setVerticalStretch(0)
|
||||||
sizePolicy2.setHeightForWidth(self.groupBox_6.sizePolicy().hasHeightForWidth())
|
sizePolicy1.setHeightForWidth(self.groupBox_6.sizePolicy().hasHeightForWidth())
|
||||||
self.groupBox_6.setSizePolicy(sizePolicy2)
|
self.groupBox_6.setSizePolicy(sizePolicy1)
|
||||||
self.gridLayout_6 = QGridLayout(self.groupBox_6)
|
self.gridLayout_6 = QGridLayout(self.groupBox_6)
|
||||||
self.gridLayout_6.setObjectName(u"gridLayout_6")
|
self.gridLayout_6.setObjectName(u"gridLayout_6")
|
||||||
self.gridLayout_6.setContentsMargins(2, 2, 2, 2)
|
self.gridLayout_6.setContentsMargins(2, 2, 2, 2)
|
||||||
@ -133,8 +118,8 @@ class Ui_fluencyCAD(object):
|
|||||||
|
|
||||||
self.groupBox_8 = QGroupBox(self.groupBox_5)
|
self.groupBox_8 = QGroupBox(self.groupBox_5)
|
||||||
self.groupBox_8.setObjectName(u"groupBox_8")
|
self.groupBox_8.setObjectName(u"groupBox_8")
|
||||||
sizePolicy2.setHeightForWidth(self.groupBox_8.sizePolicy().hasHeightForWidth())
|
sizePolicy1.setHeightForWidth(self.groupBox_8.sizePolicy().hasHeightForWidth())
|
||||||
self.groupBox_8.setSizePolicy(sizePolicy2)
|
self.groupBox_8.setSizePolicy(sizePolicy1)
|
||||||
self.gridLayout_8 = QGridLayout(self.groupBox_8)
|
self.gridLayout_8 = QGridLayout(self.groupBox_8)
|
||||||
self.gridLayout_8.setObjectName(u"gridLayout_8")
|
self.gridLayout_8.setObjectName(u"gridLayout_8")
|
||||||
self.gridLayout_8.setContentsMargins(2, 2, 2, 2)
|
self.gridLayout_8.setContentsMargins(2, 2, 2, 2)
|
||||||
@ -157,65 +142,7 @@ class Ui_fluencyCAD(object):
|
|||||||
self.verticalLayout_3.addWidget(self.groupBox_8)
|
self.verticalLayout_3.addWidget(self.groupBox_8)
|
||||||
|
|
||||||
|
|
||||||
self.gridLayout.addWidget(self.groupBox_5, 0, 3, 11, 1)
|
self.gridLayout.addWidget(self.groupBox_5, 0, 3, 12, 1)
|
||||||
|
|
||||||
self.groupBox_4 = QGroupBox(self.centralwidget)
|
|
||||||
self.groupBox_4.setObjectName(u"groupBox_4")
|
|
||||||
self.verticalLayout_2 = QVBoxLayout(self.groupBox_4)
|
|
||||||
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
|
||||||
self.pushButton_2 = QPushButton(self.groupBox_4)
|
|
||||||
self.pushButton_2.setObjectName(u"pushButton_2")
|
|
||||||
|
|
||||||
self.verticalLayout_2.addWidget(self.pushButton_2)
|
|
||||||
|
|
||||||
|
|
||||||
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 = QGroupBox(self.centralwidget)
|
||||||
self.groupBox_9.setObjectName(u"groupBox_9")
|
self.groupBox_9.setObjectName(u"groupBox_9")
|
||||||
@ -231,50 +158,23 @@ class Ui_fluencyCAD(object):
|
|||||||
|
|
||||||
self.gridLayout_7.addWidget(self.pb_origin_face, 0, 1, 1, 1)
|
self.gridLayout_7.addWidget(self.pb_origin_face, 0, 1, 1, 1)
|
||||||
|
|
||||||
|
self.pb_flip_face = QPushButton(self.groupBox_9)
|
||||||
|
self.pb_flip_face.setObjectName(u"pb_flip_face")
|
||||||
|
|
||||||
|
self.gridLayout_7.addWidget(self.pb_flip_face, 1, 0, 1, 1)
|
||||||
|
|
||||||
|
self.pb_move_wp = QPushButton(self.groupBox_9)
|
||||||
|
self.pb_move_wp.setObjectName(u"pb_move_wp")
|
||||||
|
|
||||||
|
self.gridLayout_7.addWidget(self.pb_move_wp, 1, 1, 1, 1)
|
||||||
|
|
||||||
|
|
||||||
self.gridLayout.addWidget(self.groupBox_9, 0, 0, 1, 1)
|
self.gridLayout.addWidget(self.groupBox_9, 0, 0, 1, 1)
|
||||||
|
|
||||||
self.groupBox_2 = QGroupBox(self.centralwidget)
|
|
||||||
self.groupBox_2.setObjectName(u"groupBox_2")
|
|
||||||
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)
|
|
||||||
self.pb_rectool.setObjectName(u"pb_rectool")
|
|
||||||
self.pb_rectool.setCheckable(True)
|
|
||||||
self.pb_rectool.setAutoExclusive(False)
|
|
||||||
|
|
||||||
self.gridLayout_2.addWidget(self.pb_rectool, 1, 1, 1, 1, Qt.AlignTop)
|
|
||||||
|
|
||||||
self.pb_circtool = QPushButton(self.groupBox_2)
|
|
||||||
self.pb_circtool.setObjectName(u"pb_circtool")
|
|
||||||
self.pb_circtool.setCheckable(True)
|
|
||||||
self.pb_circtool.setAutoExclusive(False)
|
|
||||||
|
|
||||||
self.gridLayout_2.addWidget(self.pb_circtool, 2, 0, 1, 1, Qt.AlignTop)
|
|
||||||
|
|
||||||
self.pb_slotool = QPushButton(self.groupBox_2)
|
|
||||||
self.pb_slotool.setObjectName(u"pb_slotool")
|
|
||||||
self.pb_slotool.setCheckable(True)
|
|
||||||
self.pb_slotool.setAutoExclusive(False)
|
|
||||||
|
|
||||||
self.gridLayout_2.addWidget(self.pb_slotool, 2, 1, 1, 1, Qt.AlignTop)
|
|
||||||
|
|
||||||
self.pb_linetool = QPushButton(self.groupBox_2)
|
|
||||||
self.pb_linetool.setObjectName(u"pb_linetool")
|
|
||||||
self.pb_linetool.setCheckable(True)
|
|
||||||
self.pb_linetool.setAutoExclusive(False)
|
|
||||||
|
|
||||||
self.gridLayout_2.addWidget(self.pb_linetool, 1, 0, 1, 1)
|
|
||||||
|
|
||||||
|
|
||||||
self.gridLayout.addWidget(self.groupBox_2, 1, 0, 1, 1)
|
|
||||||
|
|
||||||
self.groupBox_3 = QGroupBox(self.centralwidget)
|
self.groupBox_3 = QGroupBox(self.centralwidget)
|
||||||
self.groupBox_3.setObjectName(u"groupBox_3")
|
self.groupBox_3.setObjectName(u"groupBox_3")
|
||||||
sizePolicy2.setHeightForWidth(self.groupBox_3.sizePolicy().hasHeightForWidth())
|
sizePolicy1.setHeightForWidth(self.groupBox_3.sizePolicy().hasHeightForWidth())
|
||||||
self.groupBox_3.setSizePolicy(sizePolicy2)
|
self.groupBox_3.setSizePolicy(sizePolicy1)
|
||||||
self.groupBox_3.setMaximumSize(QSize(16777214, 16777213))
|
self.groupBox_3.setMaximumSize(QSize(16777214, 16777213))
|
||||||
self.gridLayout_4 = QGridLayout(self.groupBox_3)
|
self.gridLayout_4 = QGridLayout(self.groupBox_3)
|
||||||
self.gridLayout_4.setObjectName(u"gridLayout_4")
|
self.gridLayout_4.setObjectName(u"gridLayout_4")
|
||||||
@ -336,6 +236,126 @@ class Ui_fluencyCAD(object):
|
|||||||
|
|
||||||
self.gridLayout.addWidget(self.groupBox_3, 2, 0, 1, 1)
|
self.gridLayout.addWidget(self.groupBox_3, 2, 0, 1, 1)
|
||||||
|
|
||||||
|
self.InputTab = QTabWidget(self.centralwidget)
|
||||||
|
self.InputTab.setObjectName(u"InputTab")
|
||||||
|
sizePolicy2 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
|
||||||
|
sizePolicy2.setHorizontalStretch(0)
|
||||||
|
sizePolicy2.setVerticalStretch(0)
|
||||||
|
sizePolicy2.setHeightForWidth(self.InputTab.sizePolicy().hasHeightForWidth())
|
||||||
|
self.InputTab.setSizePolicy(sizePolicy2)
|
||||||
|
self.sketch_tab = QWidget()
|
||||||
|
self.sketch_tab.setObjectName(u"sketch_tab")
|
||||||
|
self.verticalLayout_4 = QVBoxLayout(self.sketch_tab)
|
||||||
|
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
|
||||||
|
self.InputTab.addTab(self.sketch_tab, "")
|
||||||
|
self.code_tab = QWidget()
|
||||||
|
self.code_tab.setObjectName(u"code_tab")
|
||||||
|
self.verticalLayout = QVBoxLayout(self.code_tab)
|
||||||
|
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||||
|
self.textEdit = QTextEdit(self.code_tab)
|
||||||
|
self.textEdit.setObjectName(u"textEdit")
|
||||||
|
|
||||||
|
self.verticalLayout.addWidget(self.textEdit)
|
||||||
|
|
||||||
|
self.groupBox_7 = QGroupBox(self.code_tab)
|
||||||
|
self.groupBox_7.setObjectName(u"groupBox_7")
|
||||||
|
self.gridLayout_5 = QGridLayout(self.groupBox_7)
|
||||||
|
self.gridLayout_5.setObjectName(u"gridLayout_5")
|
||||||
|
self.pushButton_5 = QPushButton(self.groupBox_7)
|
||||||
|
self.pushButton_5.setObjectName(u"pushButton_5")
|
||||||
|
|
||||||
|
self.gridLayout_5.addWidget(self.pushButton_5, 2, 0, 1, 1)
|
||||||
|
|
||||||
|
self.pushButton_4 = QPushButton(self.groupBox_7)
|
||||||
|
self.pushButton_4.setObjectName(u"pushButton_4")
|
||||||
|
|
||||||
|
self.gridLayout_5.addWidget(self.pushButton_4, 2, 1, 1, 1)
|
||||||
|
|
||||||
|
self.pb_apply_code = QPushButton(self.groupBox_7)
|
||||||
|
self.pb_apply_code.setObjectName(u"pb_apply_code")
|
||||||
|
|
||||||
|
self.gridLayout_5.addWidget(self.pb_apply_code, 1, 0, 1, 1)
|
||||||
|
|
||||||
|
self.pushButton = QPushButton(self.groupBox_7)
|
||||||
|
self.pushButton.setObjectName(u"pushButton")
|
||||||
|
|
||||||
|
self.gridLayout_5.addWidget(self.pushButton, 1, 1, 1, 1)
|
||||||
|
|
||||||
|
|
||||||
|
self.verticalLayout.addWidget(self.groupBox_7)
|
||||||
|
|
||||||
|
self.InputTab.addTab(self.code_tab, "")
|
||||||
|
|
||||||
|
self.gridLayout.addWidget(self.InputTab, 0, 2, 12, 1)
|
||||||
|
|
||||||
|
self.groupBox_4 = QGroupBox(self.centralwidget)
|
||||||
|
self.groupBox_4.setObjectName(u"groupBox_4")
|
||||||
|
self.verticalLayout_2 = QVBoxLayout(self.groupBox_4)
|
||||||
|
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
||||||
|
self.pushButton_2 = QPushButton(self.groupBox_4)
|
||||||
|
self.pushButton_2.setObjectName(u"pushButton_2")
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.pushButton_2)
|
||||||
|
|
||||||
|
|
||||||
|
self.gridLayout.addWidget(self.groupBox_4, 11, 5, 1, 1)
|
||||||
|
|
||||||
|
self.groupBox_2 = QGroupBox(self.centralwidget)
|
||||||
|
self.groupBox_2.setObjectName(u"groupBox_2")
|
||||||
|
sizePolicy1.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth())
|
||||||
|
self.groupBox_2.setSizePolicy(sizePolicy1)
|
||||||
|
self.gridLayout_2 = QGridLayout(self.groupBox_2)
|
||||||
|
self.gridLayout_2.setObjectName(u"gridLayout_2")
|
||||||
|
self.pb_rectool = QPushButton(self.groupBox_2)
|
||||||
|
self.pb_rectool.setObjectName(u"pb_rectool")
|
||||||
|
self.pb_rectool.setCheckable(True)
|
||||||
|
self.pb_rectool.setAutoExclusive(False)
|
||||||
|
|
||||||
|
self.gridLayout_2.addWidget(self.pb_rectool, 1, 1, 1, 1, Qt.AlignTop)
|
||||||
|
|
||||||
|
self.pb_circtool = QPushButton(self.groupBox_2)
|
||||||
|
self.pb_circtool.setObjectName(u"pb_circtool")
|
||||||
|
self.pb_circtool.setCheckable(True)
|
||||||
|
self.pb_circtool.setAutoExclusive(False)
|
||||||
|
|
||||||
|
self.gridLayout_2.addWidget(self.pb_circtool, 2, 0, 1, 1, Qt.AlignTop)
|
||||||
|
|
||||||
|
self.pb_slotool = QPushButton(self.groupBox_2)
|
||||||
|
self.pb_slotool.setObjectName(u"pb_slotool")
|
||||||
|
self.pb_slotool.setCheckable(True)
|
||||||
|
self.pb_slotool.setAutoExclusive(False)
|
||||||
|
|
||||||
|
self.gridLayout_2.addWidget(self.pb_slotool, 2, 1, 1, 1, Qt.AlignTop)
|
||||||
|
|
||||||
|
self.pb_linetool = QPushButton(self.groupBox_2)
|
||||||
|
self.pb_linetool.setObjectName(u"pb_linetool")
|
||||||
|
self.pb_linetool.setCheckable(True)
|
||||||
|
self.pb_linetool.setAutoExclusive(False)
|
||||||
|
|
||||||
|
self.gridLayout_2.addWidget(self.pb_linetool, 1, 0, 1, 1)
|
||||||
|
|
||||||
|
|
||||||
|
self.gridLayout.addWidget(self.groupBox_2, 1, 0, 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, 12, 1)
|
||||||
|
|
||||||
fluencyCAD.setCentralWidget(self.centralwidget)
|
fluencyCAD.setCentralWidget(self.centralwidget)
|
||||||
self.menubar = QMenuBar(fluencyCAD)
|
self.menubar = QMenuBar(fluencyCAD)
|
||||||
self.menubar.setObjectName(u"menubar")
|
self.menubar.setObjectName(u"menubar")
|
||||||
@ -355,13 +375,13 @@ class Ui_fluencyCAD(object):
|
|||||||
|
|
||||||
def retranslateUi(self, fluencyCAD):
|
def retranslateUi(self, fluencyCAD):
|
||||||
fluencyCAD.setWindowTitle(QCoreApplication.translate("fluencyCAD", u"fluencyCAD", None))
|
fluencyCAD.setWindowTitle(QCoreApplication.translate("fluencyCAD", u"fluencyCAD", None))
|
||||||
self.InputTab.setTabText(self.InputTab.indexOf(self.sketch_tab), QCoreApplication.translate("fluencyCAD", u"Sketch", None))
|
self.groupBox.setTitle(QCoreApplication.translate("fluencyCAD", u"Modify", None))
|
||||||
self.groupBox_7.setTitle(QCoreApplication.translate("fluencyCAD", u"Executive", None))
|
self.pb_revop.setText(QCoreApplication.translate("fluencyCAD", u"Rev", None))
|
||||||
self.pushButton_5.setText(QCoreApplication.translate("fluencyCAD", u"Load Code", None))
|
self.pb_extrdop.setText(QCoreApplication.translate("fluencyCAD", u"Extrd", None))
|
||||||
self.pushButton_4.setText(QCoreApplication.translate("fluencyCAD", u"Save code", None))
|
self.pb_arrayop.setText(QCoreApplication.translate("fluencyCAD", u"Arry", None))
|
||||||
self.pb_apply_code.setText(QCoreApplication.translate("fluencyCAD", u"Apply Code", None))
|
self.pb_cutop.setText(QCoreApplication.translate("fluencyCAD", u"Cut", None))
|
||||||
self.pushButton.setText(QCoreApplication.translate("fluencyCAD", u"Delete Code", None))
|
self.pb_combop.setText(QCoreApplication.translate("fluencyCAD", u"Comb", None))
|
||||||
self.InputTab.setTabText(self.InputTab.indexOf(self.code_tab), QCoreApplication.translate("fluencyCAD", u"Code", None))
|
self.pb_moveop.setText(QCoreApplication.translate("fluencyCAD", u"Mve", None))
|
||||||
self.groupBox_5.setTitle(QCoreApplication.translate("fluencyCAD", u"Sketch", None))
|
self.groupBox_5.setTitle(QCoreApplication.translate("fluencyCAD", u"Sketch", None))
|
||||||
self.groupBox_6.setTitle(QCoreApplication.translate("fluencyCAD", u"Tools", None))
|
self.groupBox_6.setTitle(QCoreApplication.translate("fluencyCAD", u"Tools", None))
|
||||||
self.pb_del_sketch.setText(QCoreApplication.translate("fluencyCAD", u"Del sketch", None))
|
self.pb_del_sketch.setText(QCoreApplication.translate("fluencyCAD", u"Del sketch", None))
|
||||||
@ -371,30 +391,85 @@ class Ui_fluencyCAD(object):
|
|||||||
self.pb_del_body.setText(QCoreApplication.translate("fluencyCAD", u"Del Bdy", None))
|
self.pb_del_body.setText(QCoreApplication.translate("fluencyCAD", u"Del Bdy", None))
|
||||||
self.pb_update_body.setText(QCoreApplication.translate("fluencyCAD", u"Bdy Upd", None))
|
self.pb_update_body.setText(QCoreApplication.translate("fluencyCAD", u"Bdy Upd", None))
|
||||||
self.pb_edt_sktch_3.setText(QCoreApplication.translate("fluencyCAD", u"Nothing", None))
|
self.pb_edt_sktch_3.setText(QCoreApplication.translate("fluencyCAD", u"Nothing", None))
|
||||||
|
self.groupBox_9.setTitle(QCoreApplication.translate("fluencyCAD", u"Workplanes", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_origin_wp.setToolTip(QCoreApplication.translate("fluencyCAD", u"<W>orking Plane at 0, 0, 0", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_origin_wp.setText(QCoreApplication.translate("fluencyCAD", u"WP Origin", None))
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
|
self.pb_origin_wp.setShortcut(QCoreApplication.translate("fluencyCAD", u"W", None))
|
||||||
|
#endif // QT_CONFIG(shortcut)
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_origin_face.setToolTip(QCoreApplication.translate("fluencyCAD", u"Working Plane >P<rojection at selected edges face", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_origin_face.setText(QCoreApplication.translate("fluencyCAD", u" WP Face", None))
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
|
self.pb_origin_face.setShortcut(QCoreApplication.translate("fluencyCAD", u"P", None))
|
||||||
|
#endif // QT_CONFIG(shortcut)
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_flip_face.setToolTip(QCoreApplication.translate("fluencyCAD", u"Flip >N<ormal of projected mesh.", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_flip_face.setText(QCoreApplication.translate("fluencyCAD", u"WP Flip", None))
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
|
self.pb_flip_face.setShortcut(QCoreApplication.translate("fluencyCAD", u"N", None))
|
||||||
|
#endif // QT_CONFIG(shortcut)
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_move_wp.setToolTip(QCoreApplication.translate("fluencyCAD", u">M<ove projected mesh workplane", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_move_wp.setText(QCoreApplication.translate("fluencyCAD", u"WP Mve", None))
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
|
self.pb_move_wp.setShortcut(QCoreApplication.translate("fluencyCAD", u"M", None))
|
||||||
|
#endif // QT_CONFIG(shortcut)
|
||||||
|
self.groupBox_3.setTitle(QCoreApplication.translate("fluencyCAD", u"Constrain", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_line.setToolTip(QCoreApplication.translate("fluencyCAD", u"Point to Line Constrain", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_line.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Lne", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_ptpt.setToolTip(QCoreApplication.translate("fluencyCAD", u"Poin to Point Constrain", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_ptpt.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Pt", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_horiz.setToolTip(QCoreApplication.translate("fluencyCAD", u"Horizontal Constrain ", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_horiz.setText(QCoreApplication.translate("fluencyCAD", u"Horiz", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_vert.setToolTip(QCoreApplication.translate("fluencyCAD", u"Vertical Constrain", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_vert.setText(QCoreApplication.translate("fluencyCAD", u"Vert", None))
|
||||||
|
self.pb_con_sym.setText(QCoreApplication.translate("fluencyCAD", u"Symetrc", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_dist.setToolTip(QCoreApplication.translate("fluencyCAD", u"Dimension of Line of Distance from Point to Line", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_dist.setText(QCoreApplication.translate("fluencyCAD", u"Distnce", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_mid.setToolTip(QCoreApplication.translate("fluencyCAD", u"Point to Middle Point Constrain", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_mid.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Mid_L", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_perp.setToolTip(QCoreApplication.translate("fluencyCAD", u"Constrain Line perpendicular to another line.", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.pb_con_perp.setText(QCoreApplication.translate("fluencyCAD", u"Perp_Lne", None))
|
||||||
|
self.InputTab.setTabText(self.InputTab.indexOf(self.sketch_tab), QCoreApplication.translate("fluencyCAD", u"Sketch", None))
|
||||||
|
self.groupBox_7.setTitle(QCoreApplication.translate("fluencyCAD", u"Executive", None))
|
||||||
|
self.pushButton_5.setText(QCoreApplication.translate("fluencyCAD", u"Load Code", None))
|
||||||
|
self.pushButton_4.setText(QCoreApplication.translate("fluencyCAD", u"Save code", None))
|
||||||
|
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_4.setTitle(QCoreApplication.translate("fluencyCAD", u"Export", None))
|
self.groupBox_4.setTitle(QCoreApplication.translate("fluencyCAD", u"Export", None))
|
||||||
self.pushButton_2.setText(QCoreApplication.translate("fluencyCAD", u"STL", 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))
|
|
||||||
self.groupBox_2.setTitle(QCoreApplication.translate("fluencyCAD", u"Drawing", None))
|
self.groupBox_2.setTitle(QCoreApplication.translate("fluencyCAD", u"Drawing", None))
|
||||||
self.pb_rectool.setText(QCoreApplication.translate("fluencyCAD", u"Rctgl", None))
|
self.pb_rectool.setText(QCoreApplication.translate("fluencyCAD", u"Rctgl", None))
|
||||||
self.pb_circtool.setText(QCoreApplication.translate("fluencyCAD", u"Circle", None))
|
self.pb_circtool.setText(QCoreApplication.translate("fluencyCAD", u"Circle", None))
|
||||||
self.pb_slotool.setText(QCoreApplication.translate("fluencyCAD", u"Slot", None))
|
self.pb_slotool.setText(QCoreApplication.translate("fluencyCAD", u"Slot", None))
|
||||||
|
#if QT_CONFIG(statustip)
|
||||||
|
self.pb_linetool.setStatusTip(QCoreApplication.translate("fluencyCAD", u"Line >S<egment", None))
|
||||||
|
#endif // QT_CONFIG(statustip)
|
||||||
self.pb_linetool.setText(QCoreApplication.translate("fluencyCAD", u"Line", None))
|
self.pb_linetool.setText(QCoreApplication.translate("fluencyCAD", u"Line", None))
|
||||||
self.groupBox_3.setTitle(QCoreApplication.translate("fluencyCAD", u"Constrain", None))
|
#if QT_CONFIG(shortcut)
|
||||||
self.pb_con_line.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Lne", None))
|
self.pb_linetool.setShortcut(QCoreApplication.translate("fluencyCAD", u"S", None))
|
||||||
self.pb_con_ptpt.setText(QCoreApplication.translate("fluencyCAD", u"Pt_Pt", None))
|
#endif // QT_CONFIG(shortcut)
|
||||||
self.pb_con_horiz.setText(QCoreApplication.translate("fluencyCAD", u"Horiz", None))
|
self.gl_box.setTitle(QCoreApplication.translate("fluencyCAD", u"Model Viewer", None))
|
||||||
self.pb_con_vert.setText(QCoreApplication.translate("fluencyCAD", u"Vert", 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
|
# retranslateUi
|
||||||
|
|
||||||
|
@ -18,11 +18,13 @@ class SketchWidget(QWidget):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.line_draw_buffer = [None, None]
|
self.line_draw_buffer = [None, None]
|
||||||
self.drag_buffer = [None, None]
|
self.drag_buffer = [None, None]
|
||||||
self.main_buffer = [None, None]
|
self.main_buffer = [None, None]
|
||||||
|
|
||||||
self.proj_snap_points = []
|
self.proj_snap_points = []
|
||||||
|
self.proj_snap_lines = []
|
||||||
|
|
||||||
self.hovered_point = None
|
self.hovered_point = None
|
||||||
self.selected_line = None
|
self.selected_line = None
|
||||||
@ -59,7 +61,9 @@ class SketchWidget(QWidget):
|
|||||||
for point in lines:
|
for point in lines:
|
||||||
print(point)
|
print(point)
|
||||||
x, y = point
|
x, y = point
|
||||||
self.proj_snap_points = lines
|
self.proj_snap_lines = lines
|
||||||
|
self.proj_snap_points.append(QPoint(x, y))
|
||||||
|
|
||||||
|
|
||||||
#point = self.solv.add_point_2d(x, y, self.wp)
|
#point = self.solv.add_point_2d(x, y, self.wp)
|
||||||
|
|
||||||
@ -311,6 +315,9 @@ class SketchWidget(QWidget):
|
|||||||
self.reset_buffers()
|
self.reset_buffers()
|
||||||
|
|
||||||
if event.button() == Qt.LeftButton and self.mouse_mode == "line":
|
if event.button() == Qt.LeftButton and self.mouse_mode == "line":
|
||||||
|
if self.hovered_point:
|
||||||
|
clicked_pos = self.hovered_point
|
||||||
|
else:
|
||||||
clicked_pos = local_event_pos
|
clicked_pos = local_event_pos
|
||||||
|
|
||||||
if not self.line_draw_buffer[0]:
|
if not self.line_draw_buffer[0]:
|
||||||
@ -564,6 +571,12 @@ class SketchWidget(QWidget):
|
|||||||
closest_point = point['ui_point']
|
closest_point = point['ui_point']
|
||||||
min_distance = distance
|
min_distance = distance
|
||||||
|
|
||||||
|
for point in self.proj_snap_points:
|
||||||
|
distance = (local_event_pos - point).manhattanLength()
|
||||||
|
if distance < threshold and distance < min_distance:
|
||||||
|
closest_point = point
|
||||||
|
min_distance = distance
|
||||||
|
|
||||||
if closest_point != self.hovered_point:
|
if closest_point != self.hovered_point:
|
||||||
self.hovered_point = closest_point
|
self.hovered_point = closest_point
|
||||||
print(self.hovered_point)
|
print(self.hovered_point)
|
||||||
@ -636,7 +649,7 @@ class SketchWidget(QWidget):
|
|||||||
|
|
||||||
def draw_cross(self, painter, x, y, size=10):
|
def draw_cross(self, painter, x, y, size=10):
|
||||||
# Set up the pen
|
# Set up the pen
|
||||||
pen = QPen(QColor('red')) # You can change the color as needed
|
pen = QPen(QColor('green')) # You can change the color as needed
|
||||||
pen.setWidth(int(2 / self.zoom)) # Set the line widt)h
|
pen.setWidth(int(2 / self.zoom)) # Set the line widt)h
|
||||||
painter.setPen(pen)
|
painter.setPen(pen)
|
||||||
|
|
||||||
@ -712,7 +725,7 @@ class SketchWidget(QWidget):
|
|||||||
painter.setPen(QPen(Qt.red, 2))
|
painter.setPen(QPen(Qt.red, 2))
|
||||||
painter.drawLine(p1, p2)
|
painter.drawLine(p1, p2)
|
||||||
|
|
||||||
for cross in self.proj_snap_points:
|
for cross in self.proj_snap_lines:
|
||||||
# Calculate the endpoints of the cross
|
# Calculate the endpoints of the cross
|
||||||
self.draw_cross(painter, cross[0], cross[1], 10)
|
self.draw_cross(painter, cross[0], cross[1], 10)
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
self.vtk_widget = QVTKRenderWindowInteractor(self)
|
self.vtk_widget = QVTKRenderWindowInteractor(self)
|
||||||
|
|
||||||
self.picked_edge_actors = []
|
self.picked_edge_actors = []
|
||||||
|
self.displayed_normal_actors = []
|
||||||
|
|
||||||
|
self.flip_toggle = False
|
||||||
|
|
||||||
# Create layout and add VTK widget
|
# Create layout and add VTK widget
|
||||||
layout = QtWidgets.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
@ -38,8 +41,26 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
|
|
||||||
# Set up the camera
|
# Set up the camera
|
||||||
self.camera = self.renderer.GetActiveCamera()
|
self.camera = self.renderer.GetActiveCamera()
|
||||||
self.camera.SetPosition(5, 5, 100)
|
self.camera.SetPosition(5, 5, 1000)
|
||||||
self.camera.SetFocalPoint(0, 0, 0)
|
self.camera.SetFocalPoint(0, 0, 0)
|
||||||
|
self.camera.SetClippingRange(0.1, 10000)
|
||||||
|
|
||||||
|
# Light Setup
|
||||||
|
def add_light(renderer, position, color=(1, 1, 1), intensity=1.0):
|
||||||
|
light = vtk.vtkLight()
|
||||||
|
light.SetPosition(position)
|
||||||
|
light.SetColor(color)
|
||||||
|
light.SetIntensity(intensity)
|
||||||
|
renderer.AddLight(light)
|
||||||
|
|
||||||
|
# Add lights from multiple directions
|
||||||
|
add_light(self.renderer, (1000, 0, 0), intensity=1.5)
|
||||||
|
add_light(self.renderer, (-1000, 0, 0), intensity=1.5)
|
||||||
|
add_light(self.renderer, (0, 1000, 0), intensity=1.5)
|
||||||
|
add_light(self.renderer, (0, -1000, 0), intensity=1.5)
|
||||||
|
add_light(self.renderer, (0, 0, 1000), intensity=1.5)
|
||||||
|
add_light(self.renderer, (0, 0, -1000), intensity=1.5)
|
||||||
|
|
||||||
|
|
||||||
# Set up picking
|
# Set up picking
|
||||||
self.picker = vtk.vtkCellPicker()
|
self.picker = vtk.vtkCellPicker()
|
||||||
@ -81,6 +102,14 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
self.interactor.Initialize()
|
self.interactor.Initialize()
|
||||||
self.interactor.Start()
|
self.interactor.Start()
|
||||||
|
|
||||||
|
def on_receive_command(self, command):
|
||||||
|
"""Calls the individual commands pressed in main"""
|
||||||
|
print("Receive command: ", command)
|
||||||
|
if command == "flip":
|
||||||
|
self.clear_actors_projection()
|
||||||
|
self.flip_toggle = not self.flip_toggle # Toggle the flag
|
||||||
|
self.on_invert_normal()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def compute_normal_from_lines(line1, line2):
|
def compute_normal_from_lines(line1, line2):
|
||||||
vec1 = line1[1] - line1[0]
|
vec1 = line1[1] - line1[0]
|
||||||
@ -142,18 +171,17 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
|
|
||||||
actor = vtk.vtkActor()
|
actor = vtk.vtkActor()
|
||||||
actor.SetMapper(mapper)
|
actor.SetMapper(mapper)
|
||||||
actor.GetProperty().SetColor(0.0, 0.0, 1.0) # Set color to red
|
actor.GetProperty().SetColor(1.0, 1.0, 1.0)
|
||||||
actor.GetProperty().SetLineWidth(2) # Set line width
|
actor.GetProperty().SetLineWidth(2) # Set line width
|
||||||
|
|
||||||
# Add the actor to the scene
|
# Add the actor to the scene
|
||||||
self.renderer.AddActor(actor)
|
self.renderer.AddActor(actor)
|
||||||
#self.renderer.SetBackground(0.1, 0.2, 0.4) # Set background color
|
|
||||||
|
|
||||||
mapper.Update()
|
mapper.Update()
|
||||||
self.vtk_widget.GetRenderWindow().Render()
|
self.vtk_widget.GetRenderWindow().Render()
|
||||||
|
|
||||||
|
|
||||||
def render_from_points_direct_with_faces(self, vertices, faces, color=(1, 1, 1), line_width=2, point_size=5):
|
def render_from_points_direct_with_faces(self, vertices, faces, color=(0.1, 0.2, 0.8), line_width=2, point_size=5):
|
||||||
points = vtk.vtkPoints()
|
points = vtk.vtkPoints()
|
||||||
|
|
||||||
# Use SetData with numpy array
|
# Use SetData with numpy array
|
||||||
@ -185,6 +213,7 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
mirror_transform = vtk.vtkTransform()
|
mirror_transform = vtk.vtkTransform()
|
||||||
|
|
||||||
if self.local_matrix:
|
if self.local_matrix:
|
||||||
|
"""Transforming to the position of the sketch projection with invert matrix"""
|
||||||
print(self.local_matrix)
|
print(self.local_matrix)
|
||||||
matrix = vtk.vtkMatrix4x4()
|
matrix = vtk.vtkMatrix4x4()
|
||||||
matrix.DeepCopy(self.local_matrix)
|
matrix.DeepCopy(self.local_matrix)
|
||||||
@ -210,7 +239,7 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
actor = vtk.vtkActor()
|
actor = vtk.vtkActor()
|
||||||
actor.SetMapper(mapper)
|
actor.SetMapper(mapper)
|
||||||
actor.GetProperty().SetColor(color)
|
actor.GetProperty().SetColor(color)
|
||||||
actor.GetProperty().EdgeVisibilityOn()
|
actor.GetProperty().EdgeVisibilityOff()
|
||||||
actor.GetProperty().SetLineWidth(line_width)
|
actor.GetProperty().SetLineWidth(line_width)
|
||||||
|
|
||||||
self.renderer.AddActor(actor)
|
self.renderer.AddActor(actor)
|
||||||
@ -438,6 +467,11 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
|
|
||||||
return actor # Return the actor in case you need to remove or modify it later
|
return actor # Return the actor in case you need to remove or modify it later
|
||||||
|
|
||||||
|
def on_invert_normal(self):
|
||||||
|
# Kippstufe für Normal flip
|
||||||
|
if self.selected_normal is not None:
|
||||||
|
self.compute_projection(self.flip_toggle)
|
||||||
|
|
||||||
def on_click(self, obj, event):
|
def on_click(self, obj, event):
|
||||||
click_pos = self.interactor.GetEventPosition()
|
click_pos = self.interactor.GetEventPosition()
|
||||||
|
|
||||||
@ -468,8 +502,8 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
point1 = np.array(proj_point1)
|
point1 = np.array(proj_point1)
|
||||||
point2 = np.array(proj_point2)
|
point2 = np.array(proj_point2)
|
||||||
|
|
||||||
print(f"Line starts at: {point1}")
|
#print(f"Line starts at: {point1}")
|
||||||
print(f"Line ends at: {point2}")
|
#print(f"Line ends at: {point2}")
|
||||||
|
|
||||||
# Store this line for later use if needed
|
# Store this line for later use if needed
|
||||||
self.selected_edges.append((point1, point2))
|
self.selected_edges.append((point1, point2))
|
||||||
@ -493,12 +527,37 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
self.picked_edge_actors.append(edge_actor)
|
self.picked_edge_actors.append(edge_actor)
|
||||||
|
|
||||||
if len(self.selected_edges) == 2:
|
if len(self.selected_edges) == 2:
|
||||||
# Compute the normal from the two selected edges
|
self.compute_projection(False)
|
||||||
|
|
||||||
|
elif len(self.selected_edges) > 2:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def clear_edge_select(self, ):
|
||||||
|
# Clear selection after projection was succesful
|
||||||
|
self.selected_edges = []
|
||||||
|
self.selected_normal = []
|
||||||
|
|
||||||
|
def clear_actors_projection(self):
|
||||||
|
"""Removes all actors that were used for projection"""
|
||||||
|
for edge_line in self.picked_edge_actors:
|
||||||
|
self.renderer.RemoveActor(edge_line)
|
||||||
|
|
||||||
|
for normals in self.displayed_normal_actors:
|
||||||
|
self.renderer.RemoveActor(normals)
|
||||||
|
|
||||||
|
def compute_projection(self, direction_invert: bool= False):
|
||||||
|
# Compute the normal from the two selected edges )
|
||||||
edge1 = self.selected_edges[0][1] - self.selected_edges[0][0]
|
edge1 = self.selected_edges[0][1] - self.selected_edges[0][0]
|
||||||
edge2 = self.selected_edges[1][1] - self.selected_edges[1][0]
|
edge2 = self.selected_edges[1][1] - self.selected_edges[1][0]
|
||||||
self.selected_normal = np.cross(edge1, edge2)
|
selected_normal = np.cross(edge1, edge2)
|
||||||
self.selected_normal = self.selected_normal / np.linalg.norm(self.selected_normal)
|
selected_normal = selected_normal / np.linalg.norm(selected_normal)
|
||||||
print("Computed normal:", self.selected_normal)
|
#print("Computed normal:", self.selected_normal)
|
||||||
|
|
||||||
|
# Invert the normal in local z if direction_invert is True
|
||||||
|
if direction_invert:
|
||||||
|
self.selected_normal = -selected_normal
|
||||||
|
else:
|
||||||
|
self.selected_normal = selected_normal
|
||||||
|
|
||||||
centroid = np.mean([point for edge in self.selected_edges for point in edge], axis=0)
|
centroid = np.mean([point for edge in self.selected_edges for point in edge], axis=0)
|
||||||
|
|
||||||
@ -507,13 +566,15 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
normal_actor = self.add_normal_line(centroid, self.selected_normal, length=normal_length,
|
normal_actor = self.add_normal_line(centroid, self.selected_normal, length=normal_length,
|
||||||
color=(1, 0, 0))
|
color=(1, 0, 0))
|
||||||
|
|
||||||
|
polydata = self.picker.GetActor().GetMapper().GetInput()
|
||||||
|
|
||||||
projected_polydata = self.project_mesh_to_plane(polydata, self.selected_normal, centroid)
|
projected_polydata = self.project_mesh_to_plane(polydata, self.selected_normal, centroid)
|
||||||
projected_points = projected_polydata.GetPoints()
|
projected_points = projected_polydata.GetPoints()
|
||||||
print("proj_points", projected_points)
|
#print("proj_points", projected_points)
|
||||||
|
|
||||||
# Extract 2D coordinates
|
# Extract 2D coordinates
|
||||||
self.project_tosketch_edge = self.compute_2d_coordinates(projected_polydata, self.selected_normal)
|
self.project_tosketch_edge = self.compute_2d_coordinates(projected_polydata, self.selected_normal)
|
||||||
print("3d_points_proj", self.project_tosketch_edge)
|
#print("3d_points_proj", self.project_tosketch_edge)
|
||||||
|
|
||||||
# Create a mapper and actor for the projected data
|
# Create a mapper and actor for the projected data
|
||||||
mapper = vtk.vtkPolyDataMapper()
|
mapper = vtk.vtkPolyDataMapper()
|
||||||
@ -525,20 +586,11 @@ class VTKWidget(QtWidgets.QWidget):
|
|||||||
actor.GetProperty().SetLineWidth(4) # Set line width
|
actor.GetProperty().SetLineWidth(4) # Set line width
|
||||||
|
|
||||||
self.renderer.AddActor(normal_actor)
|
self.renderer.AddActor(normal_actor)
|
||||||
|
self.displayed_normal_actors.append(normal_actor)
|
||||||
|
|
||||||
# Add the actor to the scene
|
# Add the actor to the scene
|
||||||
self.renderer.AddActor(actor)
|
self.renderer.AddActor(actor)
|
||||||
|
self.picked_edge_actors.append(actor)
|
||||||
# Clear selection after
|
|
||||||
self.selected_edges = []
|
|
||||||
self.selected_normal = []
|
|
||||||
for edge_line in self.picked_edge_actors:
|
|
||||||
self.renderer.RemoveActor(edge_line)
|
|
||||||
|
|
||||||
elif len(self.selected_edges) > 2:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Render the scene
|
# Render the scene
|
||||||
self.vtk_widget.GetRenderWindow().Render()
|
self.vtk_widget.GetRenderWindow().Render()
|
||||||
|
563
gui.ui
563
gui.ui
@ -15,73 +15,58 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="2" rowspan="11">
|
<item row="0" column="5" rowspan="10" alignment="Qt::AlignTop">
|
||||||
<widget class="QTabWidget" name="InputTab">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="sketch_tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Sketch</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="code_tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Code</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="textEdit"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_7">
|
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Executive</string>
|
<string>Modify</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="2" column="0">
|
<item row="2" column="1">
|
||||||
<widget class="QPushButton" name="pushButton_5">
|
<widget class="QPushButton" name="pb_revop">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load Code</string>
|
<string>Rev</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="pushButton_4">
|
<widget class="QPushButton" name="pb_extrdop">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Save code</string>
|
<string>Extrd</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="pb_arrayop">
|
||||||
|
<property name="text">
|
||||||
|
<string>Arry</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="pb_cutop">
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="1. Bigger obj 2. smaller object">Cut</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="pb_apply_code">
|
<widget class="QPushButton" name="pb_combop">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Apply Code</string>
|
<string>Comb</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="pb_moveop">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete Code</string>
|
<string>Mve</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="0" column="3" rowspan="12">
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3" rowspan="11">
|
|
||||||
<widget class="QGroupBox" name="groupBox_5">
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
@ -212,7 +197,277 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="5">
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox_9">
|
||||||
|
<property name="title">
|
||||||
|
<string>Workplanes</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="pb_origin_wp">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><W>orking Plane at 0, 0, 0</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>WP Origin</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>W</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="pb_origin_face">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Working Plane >P<rojection at selected edges face</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string> WP Face</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>P</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="pb_flip_face">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Flip >N<ormal of projected mesh.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>WP Flip</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>N</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="pb_move_wp">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>>M<ove projected mesh workplane</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>WP Mve</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>M</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777214</width>
|
||||||
|
<height>16777213</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Constrain</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="pb_con_line">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Point to Line Constrain</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Pt_Lne</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="pb_con_ptpt">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Poin to Point Constrain</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Pt_Pt</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="pb_con_horiz">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Horizontal Constrain </string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Horiz</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="pb_con_vert">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Vertical Constrain</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Vert</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QPushButton" name="pb_con_sym">
|
||||||
|
<property name="text">
|
||||||
|
<string>Symetrc</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QPushButton" name="pb_con_dist">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Dimension of Line of Distance from Point to Line</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Distnce</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRepeatDelay">
|
||||||
|
<number>297</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="pb_con_mid">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Point to Middle Point Constrain</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Pt_Mid_L</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="pb_con_perp">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Constrain Line perpendicular to another line.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Perp_Lne</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" rowspan="12">
|
||||||
|
<widget class="QTabWidget" name="InputTab">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="sketch_tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Sketch</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="code_tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Code</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="textEdit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
|
<property name="title">
|
||||||
|
<string>Executive</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="pushButton_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Load Code</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="pushButton_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save code</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="pb_apply_code">
|
||||||
|
<property name="text">
|
||||||
|
<string>Apply Code</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete Code</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="5">
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Export</string>
|
<string>Export</string>
|
||||||
@ -228,92 +483,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4" rowspan="11">
|
|
||||||
<widget class="QGroupBox" name="gl_box">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>4</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Model Viewer</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>12</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="5" rowspan="10" alignment="Qt::AlignTop">
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Modify</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="pb_extrdop">
|
|
||||||
<property name="text">
|
|
||||||
<string>Extrd</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QPushButton" name="pb_cutop">
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="1. Bigger obj 2. smaller object">Cut</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QPushButton" name="pb_arrayop">
|
|
||||||
<property name="text">
|
|
||||||
<string>Arry</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QPushButton" name="pb_revop">
|
|
||||||
<property name="text">
|
|
||||||
<string>Rev</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QGroupBox" name="groupBox_9">
|
|
||||||
<property name="title">
|
|
||||||
<string>Workplanes</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_7">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="pb_origin_wp">
|
|
||||||
<property name="text">
|
|
||||||
<string>WP Origin</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QPushButton" name="pb_origin_face">
|
|
||||||
<property name="text">
|
|
||||||
<string> WP Face</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -367,8 +536,14 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="pb_linetool">
|
<widget class="QPushButton" name="pb_linetool">
|
||||||
|
<property name="statusTip">
|
||||||
|
<string>Line >S<egment</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Line</string>
|
<string extracomment="Line >S<egment">Line</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>S</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -381,125 +556,29 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="0" column="4" rowspan="12">
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="gl_box">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>4</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="font">
|
||||||
<size>
|
<font>
|
||||||
<width>16777214</width>
|
<pointsize>12</pointsize>
|
||||||
<height>16777213</height>
|
</font>
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Constrain</string>
|
<string>Model Viewer</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item row="0" column="1">
|
<property name="spacing">
|
||||||
<widget class="QPushButton" name="pb_con_line">
|
<number>-1</number>
|
||||||
<property name="text">
|
|
||||||
<string>Pt_Lne</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="leftMargin">
|
||||||
<bool>true</bool>
|
<number>12</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoExclusive">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="pb_con_ptpt">
|
|
||||||
<property name="text">
|
|
||||||
<string>Pt_Pt</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoExclusive">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QPushButton" name="pb_con_horiz">
|
|
||||||
<property name="text">
|
|
||||||
<string>Horiz</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoExclusive">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QPushButton" name="pb_con_vert">
|
|
||||||
<property name="text">
|
|
||||||
<string>Vert</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoExclusive">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QPushButton" name="pb_con_sym">
|
|
||||||
<property name="text">
|
|
||||||
<string>Symetrc</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoExclusive">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QPushButton" name="pb_con_dist">
|
|
||||||
<property name="text">
|
|
||||||
<string>Distnce</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoExclusive">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoRepeatDelay">
|
|
||||||
<number>297</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QPushButton" name="pb_con_mid">
|
|
||||||
<property name="text">
|
|
||||||
<string>Pt_Mid_L</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QPushButton" name="pb_con_perp">
|
|
||||||
<property name="text">
|
|
||||||
<string>Perp_Lne</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
19
main.py
19
main.py
@ -1,6 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
import names
|
import names
|
||||||
from PySide6.QtCore import Qt, QPoint
|
from PySide6.QtCore import Qt, QPoint, Signal
|
||||||
from PySide6.QtWidgets import QApplication, QMainWindow, QSizePolicy, QInputDialog, QDialog, QVBoxLayout, QHBoxLayout, QLabel, QDoubleSpinBox, QCheckBox, QPushButton
|
from PySide6.QtWidgets import QApplication, QMainWindow, QSizePolicy, QInputDialog, QDialog, QVBoxLayout, QHBoxLayout, QLabel, QDoubleSpinBox, QCheckBox, QPushButton
|
||||||
from Gui import Ui_fluencyCAD # Import the generated GUI module
|
from Gui import Ui_fluencyCAD # Import the generated GUI module
|
||||||
from drawing_modules.vtk_widget import VTKWidget
|
from drawing_modules.vtk_widget import VTKWidget
|
||||||
@ -10,7 +10,6 @@ from sdf import *
|
|||||||
from python_solvespace import SolverSystem, ResultFlag
|
from python_solvespace import SolverSystem, ResultFlag
|
||||||
from mesh_modules import simple_mesh, vesta_mesh, interactor_mesh
|
from mesh_modules import simple_mesh, vesta_mesh, interactor_mesh
|
||||||
|
|
||||||
|
|
||||||
# main, draw_widget, gl_widget
|
# main, draw_widget, gl_widget
|
||||||
|
|
||||||
class ExtrudeDialog(QDialog):
|
class ExtrudeDialog(QDialog):
|
||||||
@ -52,6 +51,8 @@ class ExtrudeDialog(QDialog):
|
|||||||
return self.length_input.value(), self.symmetric_checkbox.isChecked()
|
return self.length_input.value(), self.symmetric_checkbox.isChecked()
|
||||||
|
|
||||||
class MainWindow(QMainWindow):
|
class MainWindow(QMainWindow):
|
||||||
|
send_command = Signal(str)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@ -90,6 +91,8 @@ class MainWindow(QMainWindow):
|
|||||||
self.ui.pb_del_sketch.pressed.connect(self.del_sketch)
|
self.ui.pb_del_sketch.pressed.connect(self.del_sketch)
|
||||||
self.ui.pb_edt_sktch.pressed.connect(self.edit_sketch)
|
self.ui.pb_edt_sktch.pressed.connect(self.edit_sketch)
|
||||||
|
|
||||||
|
self.ui.pb_flip_face.pressed.connect(self.on_flip_face)
|
||||||
|
|
||||||
###Modes
|
###Modes
|
||||||
self.ui.pb_linetool.pressed.connect(self.act_line_mode)
|
self.ui.pb_linetool.pressed.connect(self.act_line_mode)
|
||||||
self.ui.pb_con_ptpt.pressed.connect(self.act_constrain_pt_pt_mode)
|
self.ui.pb_con_ptpt.pressed.connect(self.act_constrain_pt_pt_mode)
|
||||||
@ -105,6 +108,12 @@ class MainWindow(QMainWindow):
|
|||||||
self.ui.pb_del_body.pressed.connect(self.del_body)
|
self.ui.pb_del_body.pressed.connect(self.del_body)
|
||||||
|
|
||||||
self.sketchWidget.constrain_done.connect(self.draw_op_complete)
|
self.sketchWidget.constrain_done.connect(self.draw_op_complete)
|
||||||
|
self.setFocusPolicy(Qt.StrongFocus)
|
||||||
|
|
||||||
|
self.send_command.connect(self.custom_3D_Widget.on_receive_command)
|
||||||
|
|
||||||
|
def on_flip_face(self):
|
||||||
|
self.send_command.emit("flip")
|
||||||
|
|
||||||
def add_new_sketch_origin(self):
|
def add_new_sketch_origin(self):
|
||||||
self.sketchWidget.clear_sketch()
|
self.sketchWidget.clear_sketch()
|
||||||
@ -119,6 +128,10 @@ class MainWindow(QMainWindow):
|
|||||||
self.sketchWidget.create_workplane_projected()
|
self.sketchWidget.create_workplane_projected()
|
||||||
self.sketchWidget.create_proj_lines(edges)
|
self.sketchWidget.create_proj_lines(edges)
|
||||||
|
|
||||||
|
# CLear all selections after it has been projected
|
||||||
|
self.custom_3D_Widget.clear_edge_select()
|
||||||
|
self.custom_3D_Widget.clear_actors_projection()
|
||||||
|
|
||||||
#self.sketchWidget.create_workplane_space(edges, normal)
|
#self.sketchWidget.create_workplane_space(edges, normal)
|
||||||
|
|
||||||
def act_line_mode(self):
|
def act_line_mode(self):
|
||||||
@ -476,4 +489,4 @@ if __name__ == "__main__":
|
|||||||
window.show()
|
window.show()
|
||||||
app.exec()
|
app.exec()
|
||||||
|
|
||||||
#pyside6-uic gui.ui > Gui.py -g python
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user