Commit of missing py files
This commit is contained in:
parent
7008140c95
commit
b2da28cb6d
193
WorkFeature/ParCurve/Ui/WF_ObjParCurve2DEditGui_2016.py
Normal file
193
WorkFeature/ParCurve/Ui/WF_ObjParCurve2DEditGui_2016.py
Normal file
|
@ -0,0 +1,193 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'WF_ObjParCurve2DEditGui_2016.ui'
|
||||
#
|
||||
# Created: Wed Jan 4 06:51:39 2017
|
||||
# by: PySide UI code generator 4.11.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName(_fromUtf8("Form"))
|
||||
Form.resize(1039, 460)
|
||||
self.gridLayout_3 = QtGui.QGridLayout(Form)
|
||||
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
|
||||
self.groupBox_2 = QtGui.QGroupBox(Form)
|
||||
self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.groupBox_2)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.button_load = QtGui.QPushButton(self.groupBox_2)
|
||||
self.button_load.setObjectName(_fromUtf8("button_load"))
|
||||
self.horizontalLayout.addWidget(self.button_load)
|
||||
self.button_save = QtGui.QPushButton(self.groupBox_2)
|
||||
self.button_save.setObjectName(_fromUtf8("button_save"))
|
||||
self.horizontalLayout.addWidget(self.button_save)
|
||||
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
|
||||
self.gridLayout_3.addWidget(self.groupBox_2, 0, 0, 1, 1)
|
||||
self.tableWidget = QtGui.QTableWidget(Form)
|
||||
self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
|
||||
self.tableWidget.setColumnCount(10)
|
||||
self.tableWidget.setRowCount(2)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setVerticalHeaderItem(0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setVerticalHeaderItem(1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(3, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(4, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(5, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(6, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(7, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(8, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(9, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 3, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 4, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 5, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 6, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 7, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 8, item)
|
||||
self.gridLayout_3.addWidget(self.tableWidget, 1, 0, 1, 1)
|
||||
self.groupBox = QtGui.QGroupBox(Form)
|
||||
self.groupBox.setObjectName(_fromUtf8("groupBox"))
|
||||
self.gridLayout_2 = QtGui.QGridLayout(self.groupBox)
|
||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
||||
self.button_addRow = QtGui.QPushButton(self.groupBox)
|
||||
self.button_addRow.setObjectName(_fromUtf8("button_addRow"))
|
||||
self.horizontalLayout_2.addWidget(self.button_addRow)
|
||||
self.button_removeRow = QtGui.QPushButton(self.groupBox)
|
||||
self.button_removeRow.setObjectName(_fromUtf8("button_removeRow"))
|
||||
self.horizontalLayout_2.addWidget(self.button_removeRow)
|
||||
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem1)
|
||||
self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
|
||||
self.gridLayout_3.addWidget(self.groupBox, 2, 0, 1, 1)
|
||||
self.horizontalLayout_4 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
|
||||
self.comboBox_select = QtGui.QComboBox(Form)
|
||||
self.comboBox_select.setEnabled(False)
|
||||
self.comboBox_select.setMaximumSize(QtCore.QSize(0, 0))
|
||||
self.comboBox_select.setFrame(True)
|
||||
self.comboBox_select.setModelColumn(1)
|
||||
self.comboBox_select.setObjectName(_fromUtf8("comboBox_select"))
|
||||
self.horizontalLayout_4.addWidget(self.comboBox_select)
|
||||
spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_4.addItem(spacerItem2)
|
||||
self.gridLayout_3.addLayout(self.horizontalLayout_4, 3, 0, 1, 1)
|
||||
self.horizontalLayout_3 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
|
||||
self.button_quit = QtGui.QPushButton(Form)
|
||||
self.button_quit.setObjectName(_fromUtf8("button_quit"))
|
||||
self.horizontalLayout_3.addWidget(self.button_quit)
|
||||
spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_3.addItem(spacerItem3)
|
||||
self.gridLayout_3.addLayout(self.horizontalLayout_3, 4, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
Form.setWindowTitle(_translate("Form", "Form", None))
|
||||
self.groupBox_2.setTitle(_translate("Form", "2D Database", None))
|
||||
self.button_load.setToolTip(_translate("Form", "Click to load common and customs curves.", None))
|
||||
self.button_load.setText(_translate("Form", "Load", None))
|
||||
self.button_save.setToolTip(_translate("Form", "This will save customs curves only in your HOME directory under \"Parametric2D.dat\".", None))
|
||||
self.button_save.setText(_translate("Form", "Save", None))
|
||||
item = self.tableWidget.verticalHeaderItem(0)
|
||||
item.setText(_translate("Form", "1", None))
|
||||
item = self.tableWidget.verticalHeaderItem(1)
|
||||
item.setText(_translate("Form", "2", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(0)
|
||||
item.setText(_translate("Form", "Name", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(1)
|
||||
item.setText(_translate("Form", "a (t) ", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(2)
|
||||
item.setText(_translate("Form", "b (a, t) ", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(3)
|
||||
item.setText(_translate("Form", "X (a,b,c,t)", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(4)
|
||||
item.setText(_translate("Form", "Y (a,b,c,t)", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(5)
|
||||
item.setText(_translate("Form", "t min", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(6)
|
||||
item.setText(_translate("Form", "t max", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(7)
|
||||
item.setText(_translate("Form", "t step", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(8)
|
||||
item.setText(_translate("Form", "Polar", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(9)
|
||||
item.setText(_translate("Form", "Comments", None))
|
||||
__sortingEnabled = self.tableWidget.isSortingEnabled()
|
||||
self.tableWidget.setSortingEnabled(False)
|
||||
item = self.tableWidget.item(0, 0)
|
||||
item.setText(_translate("Form", "Circle", None))
|
||||
item = self.tableWidget.item(0, 1)
|
||||
item.setText(_translate("Form", "10 # Radius", None))
|
||||
item = self.tableWidget.item(0, 2)
|
||||
item.setText(_translate("Form", "a", None))
|
||||
item = self.tableWidget.item(0, 3)
|
||||
item.setText(_translate("Form", "a*cos(t)", None))
|
||||
item = self.tableWidget.item(0, 4)
|
||||
item.setText(_translate("Form", "a*sin(t)", None))
|
||||
item = self.tableWidget.item(0, 5)
|
||||
item.setText(_translate("Form", "0", None))
|
||||
item = self.tableWidget.item(0, 6)
|
||||
item.setText(_translate("Form", "2*pi", None))
|
||||
item = self.tableWidget.item(0, 7)
|
||||
item.setText(_translate("Form", "0.01", None))
|
||||
item = self.tableWidget.item(0, 8)
|
||||
item.setText(_translate("Form", "0", None))
|
||||
self.tableWidget.setSortingEnabled(__sortingEnabled)
|
||||
self.groupBox.setTitle(_translate("Form", "Row", None))
|
||||
self.button_addRow.setToolTip(_translate("Form", "Add a row into the table.", None))
|
||||
self.button_addRow.setText(_translate("Form", "add", None))
|
||||
self.button_removeRow.setToolTip(_translate("Form", "Remove a row from the table.", None))
|
||||
self.button_removeRow.setText(_translate("Form", "remove", None))
|
||||
self.button_quit.setText(_translate("Form", "Quit", None))
|
||||
|
248
WorkFeature/ParCurve/Ui/WF_ObjParCurve3DEditGui_2016.py
Normal file
248
WorkFeature/ParCurve/Ui/WF_ObjParCurve3DEditGui_2016.py
Normal file
|
@ -0,0 +1,248 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'WF_ObjParCurve3DEditGui_2016.ui'
|
||||
#
|
||||
# Created: Wed Jan 4 06:51:50 2017
|
||||
# by: PySide UI code generator 4.11.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName(_fromUtf8("Form"))
|
||||
Form.resize(1247, 460)
|
||||
self.gridLayout_3 = QtGui.QGridLayout(Form)
|
||||
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
|
||||
self.groupBox_2 = QtGui.QGroupBox(Form)
|
||||
self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.groupBox_2)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.button_load = QtGui.QPushButton(self.groupBox_2)
|
||||
self.button_load.setObjectName(_fromUtf8("button_load"))
|
||||
self.horizontalLayout.addWidget(self.button_load)
|
||||
self.button_save = QtGui.QPushButton(self.groupBox_2)
|
||||
self.button_save.setObjectName(_fromUtf8("button_save"))
|
||||
self.horizontalLayout.addWidget(self.button_save)
|
||||
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
|
||||
self.gridLayout_3.addWidget(self.groupBox_2, 0, 0, 1, 1)
|
||||
self.tableWidget = QtGui.QTableWidget(Form)
|
||||
self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
|
||||
self.tableWidget.setColumnCount(12)
|
||||
self.tableWidget.setRowCount(3)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setVerticalHeaderItem(0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setVerticalHeaderItem(1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setVerticalHeaderItem(2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(3, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(4, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(5, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(6, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(7, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(8, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(9, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(10, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(11, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 3, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 4, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 5, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 6, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 7, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 8, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 9, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 3, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 4, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 5, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 6, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 7, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 8, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 9, item)
|
||||
self.gridLayout_3.addWidget(self.tableWidget, 1, 0, 1, 1)
|
||||
self.groupBox = QtGui.QGroupBox(Form)
|
||||
self.groupBox.setObjectName(_fromUtf8("groupBox"))
|
||||
self.gridLayout_2 = QtGui.QGridLayout(self.groupBox)
|
||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
||||
self.button_addRow = QtGui.QPushButton(self.groupBox)
|
||||
self.button_addRow.setObjectName(_fromUtf8("button_addRow"))
|
||||
self.horizontalLayout_2.addWidget(self.button_addRow)
|
||||
self.button_removeRow = QtGui.QPushButton(self.groupBox)
|
||||
self.button_removeRow.setObjectName(_fromUtf8("button_removeRow"))
|
||||
self.horizontalLayout_2.addWidget(self.button_removeRow)
|
||||
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem1)
|
||||
self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
|
||||
self.gridLayout_3.addWidget(self.groupBox, 2, 0, 1, 1)
|
||||
self.horizontalLayout_4 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
|
||||
self.comboBox_select = QtGui.QComboBox(Form)
|
||||
self.comboBox_select.setEnabled(False)
|
||||
self.comboBox_select.setMaximumSize(QtCore.QSize(0, 0))
|
||||
self.comboBox_select.setModelColumn(1)
|
||||
self.comboBox_select.setObjectName(_fromUtf8("comboBox_select"))
|
||||
self.horizontalLayout_4.addWidget(self.comboBox_select)
|
||||
spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_4.addItem(spacerItem2)
|
||||
self.gridLayout_3.addLayout(self.horizontalLayout_4, 3, 0, 1, 1)
|
||||
self.horizontalLayout_3 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
|
||||
self.button_quit = QtGui.QPushButton(Form)
|
||||
self.button_quit.setObjectName(_fromUtf8("button_quit"))
|
||||
self.horizontalLayout_3.addWidget(self.button_quit)
|
||||
spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_3.addItem(spacerItem3)
|
||||
self.gridLayout_3.addLayout(self.horizontalLayout_3, 4, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
Form.setWindowTitle(_translate("Form", "Form", None))
|
||||
self.groupBox_2.setTitle(_translate("Form", "3D Database", None))
|
||||
self.button_load.setToolTip(_translate("Form", "Click to load common and customs curves.", None))
|
||||
self.button_load.setText(_translate("Form", "Load", None))
|
||||
self.button_save.setToolTip(_translate("Form", "This will save customs curves only in your HOME directory under \"Parametric3D.dat\".", None))
|
||||
self.button_save.setText(_translate("Form", "Save", None))
|
||||
item = self.tableWidget.verticalHeaderItem(0)
|
||||
item.setText(_translate("Form", "1", None))
|
||||
item = self.tableWidget.verticalHeaderItem(1)
|
||||
item.setText(_translate("Form", "2", None))
|
||||
item = self.tableWidget.verticalHeaderItem(2)
|
||||
item.setText(_translate("Form", "3", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(0)
|
||||
item.setText(_translate("Form", "Name", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(1)
|
||||
item.setText(_translate("Form", "a (t) ", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(2)
|
||||
item.setText(_translate("Form", "b (a, t) ", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(3)
|
||||
item.setText(_translate("Form", "c (a, b, t) ", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(4)
|
||||
item.setText(_translate("Form", "X (a,b,c,t)", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(5)
|
||||
item.setText(_translate("Form", "Y (a,b,c,t)", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(6)
|
||||
item.setText(_translate("Form", "Z (a,b,c,t)", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(7)
|
||||
item.setText(_translate("Form", "t min", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(8)
|
||||
item.setText(_translate("Form", "t max", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(9)
|
||||
item.setText(_translate("Form", "t step", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(10)
|
||||
item.setText(_translate("Form", "Cartesian", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(11)
|
||||
item.setText(_translate("Form", "Comments", None))
|
||||
__sortingEnabled = self.tableWidget.isSortingEnabled()
|
||||
self.tableWidget.setSortingEnabled(False)
|
||||
item = self.tableWidget.item(0, 0)
|
||||
item.setText(_translate("Form", "Cylindrical helix", None))
|
||||
item = self.tableWidget.item(0, 1)
|
||||
item.setText(_translate("Form", "10*0.05 #Vert. step", None))
|
||||
item = self.tableWidget.item(0, 2)
|
||||
item.setText(_translate("Form", "1", None))
|
||||
item = self.tableWidget.item(0, 3)
|
||||
item.setText(_translate("Form", "10 # Radius", None))
|
||||
item = self.tableWidget.item(0, 4)
|
||||
item.setText(_translate("Form", "c*sin(t)", None))
|
||||
item = self.tableWidget.item(0, 5)
|
||||
item.setText(_translate("Form", "c*cos(t)", None))
|
||||
item = self.tableWidget.item(0, 6)
|
||||
item.setText(_translate("Form", "a*t", None))
|
||||
item = self.tableWidget.item(0, 7)
|
||||
item.setText(_translate("Form", "0", None))
|
||||
item = self.tableWidget.item(0, 8)
|
||||
item.setText(_translate("Form", "5*2*pi #5 circles", None))
|
||||
item = self.tableWidget.item(0, 9)
|
||||
item.setText(_translate("Form", "0.01", None))
|
||||
item = self.tableWidget.item(1, 0)
|
||||
item.setText(_translate("Form", "Circle with Teeth", None))
|
||||
item = self.tableWidget.item(1, 1)
|
||||
item.setText(_translate("Form", "37", None))
|
||||
item = self.tableWidget.item(1, 2)
|
||||
item.setText(_translate("Form", "1", None))
|
||||
item = self.tableWidget.item(1, 3)
|
||||
item.setText(_translate("Form", "(a+cos(a*t)*2)*b", None))
|
||||
item = self.tableWidget.item(1, 4)
|
||||
item.setText(_translate("Form", "c*cos(t)", None))
|
||||
item = self.tableWidget.item(1, 5)
|
||||
item.setText(_translate("Form", "c*sin(t)", None))
|
||||
item = self.tableWidget.item(1, 6)
|
||||
item.setText(_translate("Form", "0", None))
|
||||
item = self.tableWidget.item(1, 7)
|
||||
item.setText(_translate("Form", "0", None))
|
||||
item = self.tableWidget.item(1, 8)
|
||||
item.setText(_translate("Form", "2*pi", None))
|
||||
item = self.tableWidget.item(1, 9)
|
||||
item.setText(_translate("Form", "0.01", None))
|
||||
self.tableWidget.setSortingEnabled(__sortingEnabled)
|
||||
self.groupBox.setTitle(_translate("Form", "Row", None))
|
||||
self.button_addRow.setToolTip(_translate("Form", "Add a row into the table.", None))
|
||||
self.button_addRow.setText(_translate("Form", "add", None))
|
||||
self.button_removeRow.setToolTip(_translate("Form", "Remove a row from the table.", None))
|
||||
self.button_removeRow.setText(_translate("Form", "remove", None))
|
||||
self.button_quit.setText(_translate("Form", "Quit", None))
|
||||
|
270
WorkFeature/ParCurve/Ui/WF_ObjSurfaceEditGui_2016.py
Normal file
270
WorkFeature/ParCurve/Ui/WF_ObjSurfaceEditGui_2016.py
Normal file
|
@ -0,0 +1,270 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'WF_ObjSurfaceEditGui_2016.ui'
|
||||
#
|
||||
# Created: Wed Jan 4 06:51:59 2017
|
||||
# by: PySide UI code generator 4.11.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName(_fromUtf8("Form"))
|
||||
Form.resize(1247, 460)
|
||||
self.gridLayout_3 = QtGui.QGridLayout(Form)
|
||||
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
|
||||
self.groupBox_2 = QtGui.QGroupBox(Form)
|
||||
self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.groupBox_2)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.button_load = QtGui.QPushButton(self.groupBox_2)
|
||||
self.button_load.setObjectName(_fromUtf8("button_load"))
|
||||
self.horizontalLayout.addWidget(self.button_load)
|
||||
self.button_save = QtGui.QPushButton(self.groupBox_2)
|
||||
self.button_save.setObjectName(_fromUtf8("button_save"))
|
||||
self.horizontalLayout.addWidget(self.button_save)
|
||||
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
|
||||
self.gridLayout_3.addWidget(self.groupBox_2, 0, 0, 1, 1)
|
||||
self.tableWidget = QtGui.QTableWidget(Form)
|
||||
self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
|
||||
self.tableWidget.setColumnCount(14)
|
||||
self.tableWidget.setRowCount(3)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setVerticalHeaderItem(0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setVerticalHeaderItem(1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setVerticalHeaderItem(2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(3, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(4, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(5, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(6, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(7, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(8, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(9, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(10, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(11, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(12, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(13, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 3, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 4, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 5, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 6, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 7, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 8, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 9, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 10, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 11, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(0, 12, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 0, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 1, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 2, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 3, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 4, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 5, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 6, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 7, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 8, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 9, item)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
self.tableWidget.setItem(1, 10, item)
|
||||
self.gridLayout_3.addWidget(self.tableWidget, 1, 0, 1, 1)
|
||||
self.groupBox = QtGui.QGroupBox(Form)
|
||||
self.groupBox.setObjectName(_fromUtf8("groupBox"))
|
||||
self.gridLayout_2 = QtGui.QGridLayout(self.groupBox)
|
||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
||||
self.button_addRow = QtGui.QPushButton(self.groupBox)
|
||||
self.button_addRow.setObjectName(_fromUtf8("button_addRow"))
|
||||
self.horizontalLayout_2.addWidget(self.button_addRow)
|
||||
self.button_removeRow = QtGui.QPushButton(self.groupBox)
|
||||
self.button_removeRow.setObjectName(_fromUtf8("button_removeRow"))
|
||||
self.horizontalLayout_2.addWidget(self.button_removeRow)
|
||||
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem1)
|
||||
self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
|
||||
self.gridLayout_3.addWidget(self.groupBox, 2, 0, 1, 1)
|
||||
self.horizontalLayout_4 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
|
||||
self.comboBox_select = QtGui.QComboBox(Form)
|
||||
self.comboBox_select.setEnabled(False)
|
||||
self.comboBox_select.setMaximumSize(QtCore.QSize(0, 0))
|
||||
self.comboBox_select.setModelColumn(1)
|
||||
self.comboBox_select.setObjectName(_fromUtf8("comboBox_select"))
|
||||
self.horizontalLayout_4.addWidget(self.comboBox_select)
|
||||
spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_4.addItem(spacerItem2)
|
||||
self.gridLayout_3.addLayout(self.horizontalLayout_4, 3, 0, 1, 1)
|
||||
self.horizontalLayout_3 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
|
||||
self.button_quit = QtGui.QPushButton(Form)
|
||||
self.button_quit.setObjectName(_fromUtf8("button_quit"))
|
||||
self.horizontalLayout_3.addWidget(self.button_quit)
|
||||
spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_3.addItem(spacerItem3)
|
||||
self.gridLayout_3.addLayout(self.horizontalLayout_3, 4, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
Form.setWindowTitle(_translate("Form", "Form", None))
|
||||
self.groupBox_2.setTitle(_translate("Form", "3D Database", None))
|
||||
self.button_load.setToolTip(_translate("Form", "Click to load common and customs curves.", None))
|
||||
self.button_load.setText(_translate("Form", "Load", None))
|
||||
self.button_save.setToolTip(_translate("Form", "This will save customs curves only in your HOME directory under \"Parametric3D.dat\".", None))
|
||||
self.button_save.setText(_translate("Form", "Save", None))
|
||||
item = self.tableWidget.verticalHeaderItem(0)
|
||||
item.setText(_translate("Form", "1", None))
|
||||
item = self.tableWidget.verticalHeaderItem(1)
|
||||
item.setText(_translate("Form", "2", None))
|
||||
item = self.tableWidget.verticalHeaderItem(2)
|
||||
item.setText(_translate("Form", "3", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(0)
|
||||
item.setText(_translate("Form", "Name", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(1)
|
||||
item.setText(_translate("Form", "a", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(2)
|
||||
item.setText(_translate("Form", "b (a) ", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(3)
|
||||
item.setText(_translate("Form", "c (a, b) ", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(4)
|
||||
item.setText(_translate("Form", "X (a,b,c,u,v)", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(5)
|
||||
item.setText(_translate("Form", "Y (a,b,c,u,v)", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(6)
|
||||
item.setText(_translate("Form", "Z (a,b,c,u,v)", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(7)
|
||||
item.setText(_translate("Form", "u min", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(8)
|
||||
item.setText(_translate("Form", "u max", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(9)
|
||||
item.setText(_translate("Form", "u step", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(10)
|
||||
item.setText(_translate("Form", "v min", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(11)
|
||||
item.setText(_translate("Form", "v max", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(12)
|
||||
item.setText(_translate("Form", "v step", None))
|
||||
item = self.tableWidget.horizontalHeaderItem(13)
|
||||
item.setText(_translate("Form", "comments", None))
|
||||
__sortingEnabled = self.tableWidget.isSortingEnabled()
|
||||
self.tableWidget.setSortingEnabled(False)
|
||||
item = self.tableWidget.item(0, 0)
|
||||
item.setText(_translate("Form", "Astroid", None))
|
||||
item = self.tableWidget.item(0, 1)
|
||||
item.setText(_translate("Form", "4", None))
|
||||
item = self.tableWidget.item(0, 2)
|
||||
item.setText(_translate("Form", "3", None))
|
||||
item = self.tableWidget.item(0, 3)
|
||||
item.setText(_translate("Form", "2", None))
|
||||
item = self.tableWidget.item(0, 4)
|
||||
item.setText(_translate("Form", "a*pow(cos(v),3)*pow(cos(u),3)", None))
|
||||
item = self.tableWidget.item(0, 5)
|
||||
item.setText(_translate("Form", "b*pow(cos(v),3)*pow(sin(u),3)", None))
|
||||
item = self.tableWidget.item(0, 6)
|
||||
item.setText(_translate("Form", "c*pow(sin(v),3)", None))
|
||||
item = self.tableWidget.item(0, 7)
|
||||
item.setText(_translate("Form", "0.0", None))
|
||||
item = self.tableWidget.item(0, 8)
|
||||
item.setText(_translate("Form", "2*pi", None))
|
||||
item = self.tableWidget.item(0, 9)
|
||||
item.setText(_translate("Form", "0.01", None))
|
||||
item = self.tableWidget.item(0, 10)
|
||||
item.setText(_translate("Form", "-2.0", None))
|
||||
item = self.tableWidget.item(0, 11)
|
||||
item.setText(_translate("Form", "2.0", None))
|
||||
item = self.tableWidget.item(0, 12)
|
||||
item.setText(_translate("Form", "0.01", None))
|
||||
item = self.tableWidget.item(1, 0)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 1)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 2)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 3)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 4)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 5)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 6)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 7)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 8)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
item = self.tableWidget.item(1, 9)
|
||||
item.setText(_translate("Form", " ", None))
|
||||
self.tableWidget.setSortingEnabled(__sortingEnabled)
|
||||
self.groupBox.setTitle(_translate("Form", "Row", None))
|
||||
self.button_addRow.setToolTip(_translate("Form", "Add a row into the table.", None))
|
||||
self.button_addRow.setText(_translate("Form", "add", None))
|
||||
self.button_removeRow.setToolTip(_translate("Form", "Remove a row from the table.", None))
|
||||
self.button_removeRow.setText(_translate("Form", "remove", None))
|
||||
self.button_quit.setText(_translate("Form", "Quit", None))
|
||||
|
1536
WorkFeature/ParCurve/Ui/WF_ParCurveGui_2016.py
Normal file
1536
WorkFeature/ParCurve/Ui/WF_ParCurveGui_2016.py
Normal file
File diff suppressed because it is too large
Load Diff
110
WorkFeature/ParCurve/Utils/Coordonnees.py
Normal file
110
WorkFeature/ParCurve/Utils/Coordonnees.py
Normal file
|
@ -0,0 +1,110 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
"""
|
||||
from math import *
|
||||
|
||||
def polarToCartesian(rho = 0.0, phi = 0.0, degrees = False):
|
||||
""" Return the Cartesian (x, y) from the Polar coordinates (rho, phi).
|
||||
|
||||
Polar coordinates (r, phi) as commonly used in physics:
|
||||
If P(x, y) is the considered point in 3D space;
|
||||
Radial distance r ( > 0.0 ), is the Euclidean distance from
|
||||
the origin O (0, 0) to P(x, y).The symbol rho is often used instead of r.
|
||||
The azimuthal angle phi (or azimuth) is the signed angle measured from the
|
||||
azimuth reference direction to the segment OP on the reference plane XY
|
||||
( 0 <= phi <= pi radians (0 deg and 180 deg)).
|
||||
|
||||
degrees if a flag to indicate the phi angle is in degrees or radians.
|
||||
|
||||
"""
|
||||
|
||||
x = 0.0
|
||||
y = 0.0
|
||||
if rho < 0.0:
|
||||
return x, y
|
||||
if degrees :
|
||||
# Convert degrees to radians
|
||||
phi = phi / 360. * 2. * pi
|
||||
|
||||
x = rho * cos(phi)
|
||||
y = rho * sin(phi)
|
||||
|
||||
return x, y
|
||||
|
||||
def cartesianToPolar(x, y, z):
|
||||
|
||||
rho = 0.0
|
||||
phi = 0.0
|
||||
|
||||
return rho, phi
|
||||
|
||||
def cartesianToCylindrical(x, y, z):
|
||||
|
||||
rho = 0.0
|
||||
phi = 0.0
|
||||
|
||||
return rho, phi, z
|
||||
|
||||
def cylindricalToCartesian(rho = 0.0, phi = 0.0, z =0.0, degrees = False):
|
||||
x = 0.0
|
||||
y = 0.0
|
||||
if rho < 0.0:
|
||||
return x, y
|
||||
if degrees :
|
||||
# Convert degrees to radians
|
||||
phi = phi / 360. * 2. * pi
|
||||
|
||||
x = rho * cos(phi)
|
||||
y = rho * sin(phi)
|
||||
|
||||
return x, y, z
|
||||
|
||||
|
||||
def sphericToCartesian(rho = 0.0, theta = 0.0, phi = 0.0, degrees = False):
|
||||
""" Return the Cartesian (x, y, z) from the Spheric coordinates (rho, theta, phi).
|
||||
|
||||
Spherical coordinates (r, theta, phi) as commonly used in physics:
|
||||
radial distance r ( > 0.0 ),The symbol rho is often used instead of r.
|
||||
polar angle theta ( 0 <= theta <= 2pi radians (0 deg and 360 deg)),
|
||||
and azimuthal angle phi ( 0 <= phi <= pi radians (0 deg and 180 deg)).
|
||||
|
||||
If P(x, y, z) is the considered point in 3D space:
|
||||
the radius or radial distance is the Euclidean distance from
|
||||
the origin O (0, 0, 0) to P(x, y, z).
|
||||
The inclination (or polar angle) is the angle between the zenith direction
|
||||
and the line segment OP.
|
||||
The azimuth (or azimuthal angle) is the signed angle measured from the
|
||||
azimuth reference direction to the orthogonal projection of the line
|
||||
segment OP on the reference plane.
|
||||
"""
|
||||
|
||||
m_rho = rho
|
||||
m_theta = theta
|
||||
m_phi = phi
|
||||
|
||||
if m_rho > 0.0 :
|
||||
return
|
||||
if m_theta < 0.0 and m_theta > 2*pi :
|
||||
return
|
||||
if m_phi < 0.0 and m_phi > pi :
|
||||
return
|
||||
|
||||
x = rho * cos( phi ) * cos ( theta )
|
||||
y = rho * cos( phi ) * sin ( theta )
|
||||
z = rho * sin( phi )
|
||||
|
||||
return x, y, z
|
||||
|
||||
|
||||
def cartesianToSpheric(x, y, z):
|
||||
"""
|
||||
"""
|
||||
m_rho = 0.0
|
||||
m_theta = 0.0
|
||||
m_phi = 0.0
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print str(sphericToCartesian(1.0, pi/4, 0.0))
|
98
WorkFeature/ParCurve/Utils/Gui.py
Normal file
98
WorkFeature/ParCurve/Utils/Gui.py
Normal file
|
@ -0,0 +1,98 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
_fromUtf8 = lambda s: s
|
||||
|
||||
import FreeCAD as App
|
||||
|
||||
#Print a message on console.
|
||||
def print_msg(message):
|
||||
""" Print a message on console.
|
||||
"""
|
||||
print message
|
||||
App.Console.PrintMessage( message + "\n")
|
||||
|
||||
|
||||
# Classes
|
||||
|
||||
####################################################################################
|
||||
class DefineAndConnectEvents():
|
||||
def __init__(self, ui, obj):
|
||||
"""
|
||||
Definition of communications between a Gui and an python Object.
|
||||
This class is a base class and must be derived like :
|
||||
|
||||
class ParametricCurve2DEvents(DefineAndConnectEvents):
|
||||
def __init__(self,ui):
|
||||
self.ui = ui
|
||||
# Create Parametric Curve objects
|
||||
self.parcurv2D = ParametricCurve2D(self.ui)
|
||||
DefineAndConnectEvents.__init__(self, self.ui, self.parcurv2D)
|
||||
|
||||
|
||||
def defineEvents(self):
|
||||
#==============================
|
||||
|
||||
# Definition of connections
|
||||
|
||||
# by type of actions on widgets of the Gui.
|
||||
#==============================
|
||||
self.connections_for_button_pressed = {
|
||||
"ParCurve_button_edit_2" : "edit",
|
||||
"ParCurve_button_apply_2" : "draw",
|
||||
"ParCurve_button_store_2" : "store",
|
||||
}
|
||||
...
|
||||
"""
|
||||
if self.__class__ is DefineAndConnectEvents:
|
||||
raise Exception("Direct construction not allowed !\nSee doc of the Class.")
|
||||
self.ui = ui
|
||||
self.obj = obj
|
||||
self.defineEvents()
|
||||
self.connectEvents()
|
||||
|
||||
def defineEvents(self):
|
||||
"""
|
||||
Definition of connections by type of actions on widgets of the Gui.
|
||||
"""
|
||||
self.connections_for_slider_changed = {}
|
||||
self.connections_for_button_pressed = {}
|
||||
self.connections_for_combobox_changed = {}
|
||||
self.connections_for_checkbox_toggled = {}
|
||||
self.connections_for_spin_changed = {}
|
||||
self.connections_for_return_pressed = {}
|
||||
|
||||
def connectEvents(self):
|
||||
for m_key, m_val in self.connections_for_slider_changed.items():
|
||||
#print_msg( "Connecting : " + str(getattr(self.ui, str(m_key))) + " and " + str(getattr(self.obj, str(m_val))) )
|
||||
QtCore.QObject.connect(getattr(self.ui, str(m_key)),
|
||||
QtCore.SIGNAL("valueChanged(int)"),getattr(self.obj, str(m_val)))
|
||||
|
||||
for m_key, m_val in self.connections_for_button_pressed.items():
|
||||
#print_msg( "Connecting : " + str(getattr(self.ui, str(m_key))) + " and " + str(getattr(self.obj, str(m_val))) )
|
||||
QtCore.QObject.connect(getattr(self.ui, str(m_key)),
|
||||
QtCore.SIGNAL("pressed()"),getattr(self.obj, str(m_val)))
|
||||
|
||||
for m_key, m_val in self.connections_for_combobox_changed.items():
|
||||
#print_msg( "Connecting : " + str(getattr(self.ui, str(m_key))) + " and " + str(getattr(self.obj, str(m_val))) )
|
||||
QtCore.QObject.connect(getattr(self.ui, str(m_key)),
|
||||
QtCore.SIGNAL(_fromUtf8("currentIndexChanged(QString)")),getattr(self.obj, str(m_val)))
|
||||
|
||||
for m_key, m_val in self.connections_for_checkbox_toggled.items():
|
||||
#print_msg( "Connecting : " + str(getattr(self.ui, str(m_key))) + " and " + str(getattr(self.obj, str(m_val))) )
|
||||
QtCore.QObject.connect(getattr(self.ui, str(m_key)),
|
||||
QtCore.SIGNAL(_fromUtf8("toggled(bool)")),getattr(self.obj, str(m_val)))
|
||||
|
||||
for m_key, m_val in self.connections_for_spin_changed.items():
|
||||
#print_msg( "Connecting : " + str(getattr(self.ui, str(m_key))) + " and " + str(getattr(self.obj, str(m_val))) )
|
||||
QtCore.QObject.connect(getattr(self.ui, str(m_key)),
|
||||
QtCore.SIGNAL("valueChanged(int)"),getattr(self.obj, str(m_val)))
|
||||
|
||||
for m_key, m_val in self.connections_for_return_pressed.items():
|
||||
#print_msg( "Connecting : " + str(getattr(self.ui, str(m_key))) + " and " + str(getattr(self.obj, str(m_val))) )
|
||||
QtCore.QObject.connect(getattr(self.ui, str(m_key)),
|
||||
QtCore.SIGNAL("returnPressed()"),getattr(self.obj, str(m_val)))
|
||||
|
138
WorkFeature/ParCurve/Utils/Text.py
Normal file
138
WorkFeature/ParCurve/Utils/Text.py
Normal file
|
@ -0,0 +1,138 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
"""
|
||||
import os.path
|
||||
|
||||
from PySide import QtCore
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
_fromUtf8 = lambda s: s
|
||||
|
||||
import FreeCAD as App
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Functions
|
||||
|
||||
def write_text(filename=None, text=None):
|
||||
"""
|
||||
Write the text into an ASCII file.
|
||||
|
||||
Return True if success, false if not.
|
||||
|
||||
*filename* : (string) full path name.
|
||||
|
||||
*text* : (string) the text to write.
|
||||
"""
|
||||
if filename != None and text != None:
|
||||
try:
|
||||
__m_f=open(filename,'w')
|
||||
__m_f.write(text)
|
||||
__m_f.close()
|
||||
return True
|
||||
except:
|
||||
print "\nERROR : The file " + str(filename) + \
|
||||
" cannot be opened in write mode !"
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def append_text(filename=None, text="" ):
|
||||
"""
|
||||
Print/Add text either on screen or on at the end of an existing ASCII text file.
|
||||
|
||||
*filename* : (string) full path name.
|
||||
|
||||
*text* : (string) the text to add at the end of the file.
|
||||
"""
|
||||
if text.__class__.__name__ != 'str':
|
||||
return None
|
||||
if filename and os.path.exists(filename):
|
||||
try:
|
||||
__m_f=open(filename,'r+')
|
||||
__m_f.readlines()
|
||||
__m_f.write(text+'\n')
|
||||
__m_f.close()
|
||||
except:
|
||||
print "\nERROR : The file " + str(filename) + \
|
||||
" can not be opened for append mode !"
|
||||
return False
|
||||
else:
|
||||
print text +'\n'
|
||||
|
||||
def read_text_into_list(filename):
|
||||
"""
|
||||
Read the complete ASCII file *filename* (if possible) into a unique
|
||||
list of strings and return the list
|
||||
(or None in case of error).
|
||||
|
||||
Controls are done on *filename*.
|
||||
|
||||
*filename* : (string) full path name.
|
||||
"""
|
||||
if filename and os.path.exists(filename):
|
||||
try:
|
||||
__m_f=open(filename,'r')
|
||||
# read the complete ASCII file if possible into a unique list of strings
|
||||
try:
|
||||
#m_strings = __m_f.readlines()
|
||||
m_strings = __m_f.read().splitlines()
|
||||
except:
|
||||
__m_f.close()
|
||||
print "\nERROR : The file " + str(filename) + \
|
||||
" cannot be fully read !"
|
||||
return None
|
||||
finally:
|
||||
__m_f.close()
|
||||
__m_f.close()
|
||||
return m_strings
|
||||
except:
|
||||
print "\nERROR : The file " + str(filename) + \
|
||||
" cannot be opened in read mode !"
|
||||
return None
|
||||
else:
|
||||
if os.path.exists(filename) == False:
|
||||
print "\nERROR : " + str(filename) + " not a valid file !"
|
||||
return None
|
||||
|
||||
|
||||
def read_text(filename):
|
||||
"""
|
||||
Read the complete ASCII file *filename* (if possible) into a unique
|
||||
string and return the string
|
||||
(or None in case of error).
|
||||
|
||||
Controls are done on *filename*.
|
||||
|
||||
*filename* : (string) full path name.
|
||||
"""
|
||||
if filename and os.path.exists(filename):
|
||||
try:
|
||||
__m_f=open(filename,'r')
|
||||
# read the complete ASCII file if possible into a unique string
|
||||
try:
|
||||
m_string = __m_f.read()
|
||||
except:
|
||||
__m_f.close()
|
||||
print "\nERROR : The file " + str(filename) + \
|
||||
" cannot be fully read !"
|
||||
return None
|
||||
finally:
|
||||
__m_f.close()
|
||||
__m_f.close()
|
||||
return m_string
|
||||
except:
|
||||
print "\nERROR : The file " + str(filename) + \
|
||||
" cannot be opened in read mode !"
|
||||
return None
|
||||
else:
|
||||
if os.path.exists(filename) == False:
|
||||
print "\nERROR : " + str(filename) + " not a valid file !"
|
||||
return None
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
0
WorkFeature/ParCurve/Utils/__init__.py
Normal file
0
WorkFeature/ParCurve/Utils/__init__.py
Normal file
|
@ -6,11 +6,19 @@ Created on Sat May 30 18:53:08 2015
|
|||
"""
|
||||
import sys
|
||||
import os.path
|
||||
sys.path.append(os.path.dirname(__file__))
|
||||
#from ParCurve2DEditGui_2015 import Ui_Form
|
||||
#sys.path.append(os.path.dirname(__file__))
|
||||
##from ParCurve2DEditGui_2015 import Ui_Form
|
||||
|
||||
# Get the path of the current python script
|
||||
m_current_path = os.path.realpath(__file__)
|
||||
# Update paths
|
||||
if not sys.path.__contains__(m_current_path):
|
||||
sys.path.append(m_current_path)
|
||||
|
||||
import Ui.WF_ObjParCurve2DEditGui_2016 as EDIT_2D
|
||||
import Ui.WF_ObjParCurve3DEditGui_2016 as EDIT_3D
|
||||
import Ui.WF_ObjSurfaceEditGui_2016 as EDIT_SURF
|
||||
|
||||
from Utils.Text import read_text_into_list, write_text, append_text
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
|
|
|
@ -6,10 +6,10 @@ To execute the MACRO in FreeCAD python console:
|
|||
import sys
|
||||
import os.path
|
||||
|
||||
# get the path of the current python script
|
||||
#m_current_path = os.path.realpath(__file__)
|
||||
m_current_path = "/home/laurent/Develop/Workspaces/Python/WF_test/WorkFeature/ParCurve/"
|
||||
# Change this by your own FreeCAD lib path to import FreeCAD
|
||||
# Get the path of the current python script
|
||||
m_current_path = os.path.realpath(__file__)
|
||||
#m_current_path = "/home/laurent/Develop/Workspaces/Python/WF_test/WorkFeature/ParCurve/"
|
||||
# Update paths
|
||||
if not sys.path.__contains__(m_current_path):
|
||||
sys.path.append(m_current_path)
|
||||
|
||||
|
@ -241,12 +241,7 @@ class Parametric():
|
|||
self.msgBox = QtGui.QMessageBox()
|
||||
self.pbar = None
|
||||
|
||||
self.pbar = self.gui.progressBar
|
||||
self.pbar.setValue(0)
|
||||
|
||||
self.x_ref = self.gui.Par_x_ref
|
||||
self.y_ref = self.gui.Par_y_ref
|
||||
self.z_ref = self.gui.Par_z_ref
|
||||
self.setGuiStuff()
|
||||
|
||||
self.ox, self.oy, self.oz = 0.0, 0.0, 0.0
|
||||
|
||||
|
@ -256,6 +251,13 @@ class Parametric():
|
|||
print_msg("Impossible to load Module numpy !")
|
||||
return
|
||||
|
||||
def setGuiStuff(self):
|
||||
self.pbar = self.gui.progressBar
|
||||
self.pbar.setValue(0)
|
||||
|
||||
self.x_ref = self.gui.Par_x_ref
|
||||
self.y_ref = self.gui.Par_y_ref
|
||||
self.z_ref = self.gui.Par_z_ref
|
||||
|
||||
def updateOptions(self):
|
||||
pass
|
||||
|
|
1536
WorkFeature/Ui/WF_ParCurveGui_2016.py
Normal file
1536
WorkFeature/Ui/WF_ParCurveGui_2016.py
Normal file
File diff suppressed because it is too large
Load Diff
3351
WorkFeature/Ui/WF_ParCurveGui_2016.ui
Normal file
3351
WorkFeature/Ui/WF_ParCurveGui_2016.ui
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -13438,13 +13438,13 @@ class WorkFeatureTab():
|
|||
myObject = ParametricTab(ParCurveGui)
|
||||
|
||||
# Create a Regression 2D Curve object and connect
|
||||
self.reg_events2D = RegressionCurve2DEvents(self.ui)
|
||||
self.reg_events2D = RegressionCurve2DEvents(myObject.gui)
|
||||
# Create a Parametric 2D Curve object and connect
|
||||
self.events2D = ParametricCurve2DEvents(self.ui)
|
||||
self.events2D = ParametricCurve2DEvents(myObject.gui)
|
||||
# Create a Parametric 3D Curve object and connect
|
||||
self.events3D = ParametricCurve3DEvents(self.ui)
|
||||
self.events3D = ParametricCurve3DEvents(myObject.gui)
|
||||
# Create a Surface object and connect
|
||||
self.surface = SurfaceEvents(self.ui)
|
||||
self.surface = SurfaceEvents(myObject.gui)
|
||||
|
||||
def getMainWindow(self):
|
||||
""" Returns the main window
|
||||
|
|
|
@ -1,388 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sat May 30 18:53:08 2015
|
||||
|
||||
@author: laurent
|
||||
"""
|
||||
import sys
|
||||
import os.path
|
||||
sys.path.append(os.path.dirname(__file__))
|
||||
#from ParCurve2DEditGui_2015 import Ui_Form
|
||||
import WorkFeature.WF_ObjParCurve2DEditGui_2015 as EDIT_2D
|
||||
import WorkFeature.WF_ObjParCurve3DEditGui_2015 as EDIT_3D
|
||||
from WorkFeature.WF_Utils_2015 import read_text_into_list, write_text, append_text
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
import FreeCAD as App
|
||||
|
||||
global myDatabase2DName
|
||||
myDatabase2DName = "Parametric2D.dat"
|
||||
global myDatabase3DName
|
||||
myDatabase3DName = "Parametric3D.dat"
|
||||
|
||||
####################################################################################
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
_fromUtf8 = lambda s: s
|
||||
|
||||
|
||||
index = ['Name', 'a' , 'b' , 'c' , 'X' , 'Y', 'Z', 'tmin', 'tmax', 'tstep']
|
||||
d1 = ["default",37, 1, '(a+cos(a*t)*2)*b', 'cos(t)*c', 'sin(t)*c', 0, 0., '2*pi', 0.01]
|
||||
d2 = ["spiral", 5, 0, 10, 'c*sin(t)', 'c*cos(t)', 'a*0.05*t', .0, '20*pi', '0.05*pi']
|
||||
d3 = ["Seam of a tennis ball", '5', '5', '2*(sqrt(a*b))', 'a*(cos(t))+b*(cos(3*t))',
|
||||
'a*(sin(t))-b*(sin(3*t))', 'c*(sin(2*t))', 0., '2*pi', '0.05*pi']
|
||||
|
||||
|
||||
class Model(QtCore.QAbstractTableModel):
|
||||
def __init__(self,tableWidget):
|
||||
super(Model, self).__init__()
|
||||
self.table = []
|
||||
#print "Initialize table " + str(self.table)
|
||||
for i_row in range(tableWidget.rowCount()):
|
||||
m_line = []
|
||||
for i_column in range(tableWidget.columnCount()):
|
||||
#print str(i_column)
|
||||
m_item = tableWidget.item(i_row, i_column)
|
||||
if m_item is None:
|
||||
break
|
||||
else:
|
||||
#print str(tableWidget.item(i_row, i_column).text())
|
||||
m_line.append(str(tableWidget.item(i_row, i_column).text()))
|
||||
|
||||
if len(m_line) != 0:
|
||||
self.table.append(m_line)
|
||||
#print str(self.table)
|
||||
self.columnNumber = 0
|
||||
self.rowNumber = 0
|
||||
self.rowNumber = len(self.table)
|
||||
if self.rowNumber != 0:
|
||||
self.columnNumber = len(self.table[0])
|
||||
|
||||
|
||||
#print "self.rowNumber=" + str(self.rowNumber)
|
||||
#print "self.columnNumber=" + str(self.columnNumber)
|
||||
|
||||
def rowCount(self, index=QtCore.QModelIndex()):
|
||||
return self.rowNumber
|
||||
def columnCount(self, index=QtCore.QModelIndex()):
|
||||
return self.columnNumber
|
||||
def flags(self, index):
|
||||
return QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
|
||||
|
||||
def data(self, index, role):
|
||||
if role == QtCore.Qt.DisplayRole:
|
||||
return self.table[index.row()][index.column()]
|
||||
def setData(self, index, role, value):
|
||||
if role == QtCore.Qt.DisplayRole:
|
||||
self.table[index.row()][index.column()] = value
|
||||
|
||||
|
||||
class tableWidget():
|
||||
def __init__(self, database):
|
||||
"""
|
||||
parameter database : the name of database file without path.
|
||||
"""
|
||||
# Flag for common database
|
||||
self.database_exists = False
|
||||
self.database_name = None
|
||||
self.curves_number = 0
|
||||
self.curves_loaded = False
|
||||
# Flag for user database
|
||||
self.database_user_exists = False
|
||||
self.database_user_name = None
|
||||
self.curves_user_number = 0
|
||||
self.curves_user_loaded = False
|
||||
if database :
|
||||
# Check if database file exists in current script directory
|
||||
m_current = os.path.dirname(__file__)
|
||||
m_dirs_to_look = [str(m_current), str(m_current) + "/Ressources",]
|
||||
for m_dir in m_dirs_to_look:
|
||||
self.database_path = m_dir + "/"
|
||||
#print self.database_path
|
||||
self.database_name = str(self.database_path) + str(database)
|
||||
if os.path.exists(self.database_name):
|
||||
self.database_exists = True
|
||||
|
||||
# Check if database file exists in home directory
|
||||
m_home = os.path.expanduser("~")
|
||||
self.database_path = m_home + "/"
|
||||
self.database_user_name = str(self.database_path) + str(database)
|
||||
if os.path.exists(self.database_user_name):
|
||||
self.database_user_exists = True
|
||||
|
||||
self.header = None
|
||||
|
||||
# This Object ill be created with the setupUi
|
||||
#self.tableWidget = QtGui.QTableWidget(Form)
|
||||
self.tableWidget = None
|
||||
#===============================================================================
|
||||
# class tableWidget2D(EDIT_2D.Ui_Form, tableWidget):
|
||||
# def __init__(self, database="Parametric2D.dat"):
|
||||
# EDIT_2D.Ui_Form.__init__(self)
|
||||
# tableWidget.__init__(self, database)
|
||||
# self.header = "Name, a (t), b (a,t), X (a,b,t), Y(a,b,t), Polar, tmin, tmax, tstep"
|
||||
#
|
||||
# def setupUi(self, Form, combox):
|
||||
# EDIT_2D.Ui_Form.setupUi(self,Form)
|
||||
# tableWidget.setupUi(self, Form, combox)
|
||||
#===============================================================================
|
||||
self.dialog = None
|
||||
self.comboBox = None
|
||||
self.connections_for_button_pressed = None
|
||||
self.connections_for_combobox_changed = None
|
||||
self.model = None
|
||||
|
||||
def setupUi(self, Form, combox):
|
||||
self.dialog = Form
|
||||
self.comboBox = combox
|
||||
self.updateModel()
|
||||
|
||||
# Connect to functions
|
||||
self.connections_for_button_pressed = {
|
||||
"button_addRow" : "insertRowAfter",
|
||||
"button_removeRow" : "removeSelectedRow",
|
||||
"button_load" : "loadDatabase",
|
||||
"button_save" : "saveDatabase",
|
||||
"button_quit" : "widgetQuit",
|
||||
}
|
||||
self.connections_for_combobox_changed = {
|
||||
"comboBox_select" : "selectCurve",
|
||||
}
|
||||
|
||||
for m_key, m_val in self.connections_for_button_pressed.items():
|
||||
#print_msg( "Connecting : " + str(getattr(self, str(m_key))) + " and " + str(getattr(self, str(m_val))) )
|
||||
QtCore.QObject.connect(getattr(self, str(m_key)),
|
||||
QtCore.SIGNAL("pressed()"),getattr(self, str(m_val)))
|
||||
|
||||
for m_key, m_val in self.connections_for_combobox_changed.items():
|
||||
#print_msg( "Connecting : " + str(getattr(self, str(m_key))) + " and " + str(getattr(self, str(m_val))) )
|
||||
QtCore.QObject.connect(getattr(self, str(m_key)),
|
||||
QtCore.SIGNAL("currentIndexChanged(QString)"),getattr(self, str(m_val)))
|
||||
self.curves_number = 0
|
||||
self.curves_user_number = 0
|
||||
if self.database_exists:
|
||||
self.curves_number = self.loadDatabase(self.database_name)
|
||||
print "Loaded from common database : " + str(self.curves_number) + " curves !"
|
||||
if self.curves_number != 0:
|
||||
self.curves_loaded = True
|
||||
|
||||
if self.database_user_exists:
|
||||
self.curves_user_number = self.loadDatabase(self.database_user_name)
|
||||
print "Loaded from user database : " + str(self.curves_user_number) + " curves !"
|
||||
if self.curves_user_number != 0:
|
||||
self.curves_user_loaded = True
|
||||
|
||||
|
||||
def updateModel(self):
|
||||
self.model = Model(self.tableWidget)
|
||||
self.comboBox.setModel(self.model)
|
||||
self.comboBox.setModelColumn(0)
|
||||
|
||||
|
||||
def insertRow(self,row):
|
||||
self.tableWidget.insertRow(row)
|
||||
|
||||
|
||||
def insertRowAfter(self):
|
||||
self.insertRow(self.tableWidget.rowCount())
|
||||
|
||||
|
||||
def setRowCount(self,row):
|
||||
self.tableWidget.setRowCount(row)
|
||||
|
||||
|
||||
def removeSelectedRow(self):
|
||||
m_index = self.tableWidget.currentRow()
|
||||
self.removeRow(m_index)
|
||||
|
||||
|
||||
def removeRow(self,row):
|
||||
self.tableWidget.removeRow(row)
|
||||
self.updateModel()
|
||||
|
||||
|
||||
def removeLastRow(self):
|
||||
self.removeRow(self.tableWidget.rowCount()-1)
|
||||
|
||||
|
||||
def insertDataAfter(self, data, rowCount):
|
||||
if isinstance(data,list) !=True:
|
||||
print "Type of input data must be a 'list'"
|
||||
return
|
||||
m_rowNumber = len(data)
|
||||
m_columnNumber = len(data[0])
|
||||
m_widget = self.tableWidget
|
||||
for i in range(m_rowNumber):
|
||||
self.insertRowAfter()
|
||||
for j in range(m_columnNumber):
|
||||
item = QtGui.QTableWidgetItem(str(data[i][j]))
|
||||
m_widget.setItem(rowCount + i, j, item)
|
||||
self.updateModel()
|
||||
|
||||
|
||||
def insertData(self, data):
|
||||
if isinstance(data,list) !=True:
|
||||
print "Type of input data must be a 'list'"
|
||||
return
|
||||
#print str(data)
|
||||
m_rowNumber = len(data)
|
||||
m_columnNumber = len(data[0])
|
||||
m_widget = self.tableWidget
|
||||
m_widget.setRowCount(m_rowNumber)
|
||||
#m_widget.setColumnCount(columns)
|
||||
#m_widget.setHorizontalHeaderLabels(['name', 'num','x','y','z'])
|
||||
for i in range(m_rowNumber):
|
||||
for j in range(m_columnNumber):
|
||||
item = QtGui.QTableWidgetItem(str(data[i][j]))
|
||||
m_widget.setItem(i, j, item)
|
||||
self.updateModel()
|
||||
|
||||
|
||||
def addCurveData(self,data):
|
||||
m_curveList = self.selectAllCurves()
|
||||
m_curveList.append(data)
|
||||
self.insertData(m_curveList)
|
||||
|
||||
|
||||
def loadDatabase(self, my_database_name):
|
||||
try:
|
||||
m_lines = read_text_into_list(my_database_name)
|
||||
del m_lines[0]
|
||||
m_data = []
|
||||
for m_line in m_lines:
|
||||
d = eval(m_line)
|
||||
#print str(d)
|
||||
m_data.append(d)
|
||||
|
||||
#print str(self.curves_number + self.curves_user_number)
|
||||
if (self.curves_number + self.curves_user_number) == 0:
|
||||
self.insertData(m_data)
|
||||
else:
|
||||
self.insertDataAfter(m_data,(self.curves_number + self.curves_user_number))
|
||||
|
||||
return len(m_data)
|
||||
except:
|
||||
message = "Unable to load the database file :" + str(my_database_name)
|
||||
print message
|
||||
App.Console.PrintError("\nERROR : " + message)
|
||||
|
||||
|
||||
def saveDatabase(self, my_database_name = None):
|
||||
if my_database_name in [None]:
|
||||
my_database_name = self.database_user_name
|
||||
|
||||
if (self.curves_number) != 0:
|
||||
m_curves = self.selectAllCurvesFrom(self.curves_number)
|
||||
else:
|
||||
m_curves = self.selectAllCurves()
|
||||
|
||||
#print str(m_curves)
|
||||
write_text(filename=my_database_name, text=str(self.header))
|
||||
append_text(filename=my_database_name, text="")
|
||||
for m_curve in m_curves:
|
||||
append_text(filename=my_database_name, text=str(m_curve))
|
||||
|
||||
|
||||
def selectCurve(self, *argc):
|
||||
#print str(*argc)
|
||||
m_curveRow = self.tableWidget.row(self.tableWidget.findItems(str(*argc), QtCore.Qt.MatchExactly)[0])
|
||||
print str(m_curveRow)
|
||||
m_line = []
|
||||
for i_column in range(self.tableWidget.columnCount()):
|
||||
#print str(i_column)
|
||||
m_item = self.tableWidget.item(m_curveRow, i_column)
|
||||
if m_item is None:
|
||||
break
|
||||
else:
|
||||
#print str(tableWidget.item(i_row, i_column).text())
|
||||
m_line.append(str(self.tableWidget.item(m_curveRow, i_column).text()))
|
||||
#print str(m_line)
|
||||
return m_line
|
||||
|
||||
def selectAllCurvesFrom(self,row):
|
||||
m_lineList = []
|
||||
m_total_rows = self.tableWidget.rowCount()
|
||||
m_total_cols = self.tableWidget.columnCount()
|
||||
for i_row in range(row, m_total_rows):
|
||||
m_line = []
|
||||
for i_column in range(m_total_cols):
|
||||
m_item = self.tableWidget.item(i_row, i_column)
|
||||
if m_item is None:
|
||||
break
|
||||
else:
|
||||
m_line.append(str(self.tableWidget.item(i_row, i_column).text()))
|
||||
m_lineList.append(m_line)
|
||||
#print str(m_lineList)
|
||||
return m_lineList
|
||||
|
||||
|
||||
def selectAllCurves(self):
|
||||
m_lineList = []
|
||||
m_total_rows = self.tableWidget.rowCount()
|
||||
m_total_cols = self.tableWidget.columnCount()
|
||||
for i_row in range(m_total_rows):
|
||||
m_line = []
|
||||
for i_column in range(m_total_cols):
|
||||
m_item = self.tableWidget.item(i_row, i_column)
|
||||
if m_item is None:
|
||||
break
|
||||
else:
|
||||
m_line.append(str(self.tableWidget.item(i_row, i_column).text()))
|
||||
m_lineList.append(m_line)
|
||||
#print str(m_lineList)
|
||||
return m_lineList
|
||||
|
||||
def widgetQuit(self):
|
||||
self.dialog.hide()
|
||||
|
||||
|
||||
class tableWidget2D(EDIT_2D.Ui_Form, tableWidget):
|
||||
def __init__(self, database="Parametric2D.dat"):
|
||||
EDIT_2D.Ui_Form.__init__(self)
|
||||
tableWidget.__init__(self, database)
|
||||
self.header = "Name, a (t), b (a,t), X (a,b,t), Y(a,b,t), Polar, tmin, tmax, tstep"
|
||||
|
||||
def setupUi(self, Form, combox):
|
||||
EDIT_2D.Ui_Form.setupUi(self,Form)
|
||||
tableWidget.setupUi(self, Form, combox)
|
||||
|
||||
|
||||
class tableWidget3D(EDIT_3D.Ui_Form, tableWidget):
|
||||
def __init__(self, database="Parametric3D.dat"):
|
||||
EDIT_3D.Ui_Form.__init__(self)
|
||||
tableWidget.__init__(self, database)
|
||||
self.header = "Name, a (t), b (a,t),c (a,b,t), X (a,b,c,t), Y (a,b,c,t), Z (a,b,c,t), tmin, tmax, tstep"
|
||||
|
||||
def setupUi(self, Form, combox):
|
||||
EDIT_3D.Ui_Form.setupUi(self,Form)
|
||||
tableWidget.setupUi(self, Form, combox)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QtGui.QApplication(sys.argv)
|
||||
#app = QtGui.qApp
|
||||
#app.exec_()
|
||||
myNewWidget = QtGui.QDockWidget()
|
||||
myNewWidget = QtGui.QWidget()
|
||||
#myNewWidget.ui = Ui_Form()
|
||||
myNewWidget.ui = tableWidget()
|
||||
myNewWidget.ui.setupUi(myNewWidget)
|
||||
#myNewWidget.ui.insertRow(1)
|
||||
#myNewWidget.ui.insertRow(3)
|
||||
#myNewWidget.ui.removeRow(3)
|
||||
myNewWidget.ui.insertRowAfter()
|
||||
myNewWidget.ui.insertRowAfter()
|
||||
myNewWidget.ui.insertRowAfter()
|
||||
myNewWidget.ui.removeLastRow()
|
||||
#myNewWidget.ui.setRowCount(20)
|
||||
mydata = []
|
||||
mydata.append(d1)
|
||||
mydata.append(d2)
|
||||
mydata.append(d3)
|
||||
myNewWidget.ui.insertData(mydata)
|
||||
myNewWidget.show()
|
||||
|
||||
#mw = app.activeWindow()
|
||||
#mw.addDockWidget(QtCore.Qt.RightDockWidgetArea,myNewWidget)
|
||||
app.exec_()
|
|
@ -1,582 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
"""
|
||||
from WorkFeature.WF_Utils_2015 import DefineAndConnectEvents
|
||||
import WorkFeature.WF_ObjParCurveEdit_2015 as ParCurveEdit
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Draft
|
||||
import Part
|
||||
|
||||
from PySide import QtGui
|
||||
from math import *
|
||||
|
||||
####################################################################################
|
||||
# Classes
|
||||
class Parametric():
|
||||
def __init__(self, gui):
|
||||
""" A Parametric object
|
||||
"""
|
||||
self.debug = 1
|
||||
self.close = False
|
||||
self.face = False
|
||||
self.points = False
|
||||
self.poly = True
|
||||
self.bspline = False
|
||||
self.bezier = False
|
||||
self.meshes = False
|
||||
self.polar = False
|
||||
|
||||
self.dialog = None
|
||||
self.combox = None
|
||||
|
||||
self.gui = gui
|
||||
|
||||
|
||||
def updateOptions(self):
|
||||
pass
|
||||
|
||||
|
||||
def ccloseState(self, flag):
|
||||
if self.debug != 0:
|
||||
print self.ccloseState.__name__
|
||||
self.close = flag
|
||||
self.updateOptions()
|
||||
|
||||
|
||||
def cfaceState(self, flag):
|
||||
if self.debug != 0:
|
||||
print self.cfaceState.__name__
|
||||
self.face = flag
|
||||
self.updateOptions()
|
||||
|
||||
|
||||
def cpointsState(self, flag):
|
||||
if self.debug != 0:
|
||||
print self.cpointsState.__name__
|
||||
self.points = flag
|
||||
self.updateOptions()
|
||||
|
||||
|
||||
def cpolyState(self, flag):
|
||||
if self.debug != 0:
|
||||
print self.cpolyState.__name__
|
||||
self.poly = flag
|
||||
self.updateOptions()
|
||||
|
||||
|
||||
def cbsplineState(self, flag):
|
||||
if self.debug != 0:
|
||||
print self.cbsplineState.__name__
|
||||
self.bspline = flag
|
||||
self.updateOptions()
|
||||
|
||||
|
||||
def cbezierState(self, flag):
|
||||
if self.debug != 0:
|
||||
print self.cbezierState.__name__
|
||||
self.bezier = flag
|
||||
self.updateOptions()
|
||||
|
||||
|
||||
def cmeshesState (self, flag):
|
||||
if self.debug != 0:
|
||||
print self.cmeshesState.__name__
|
||||
self.meshes = flag
|
||||
self.updateOptions()
|
||||
|
||||
|
||||
def cpolarState(self, flag):
|
||||
if self.debug != 0:
|
||||
print self.ccloseState.__name__
|
||||
self.polar = flag
|
||||
self.updateOptions()
|
||||
|
||||
|
||||
def plot_matriz_old(self, matriz):
|
||||
""" Plot the dataset with different options.
|
||||
"""
|
||||
if self.debug != 0:
|
||||
print self.plot_matriz.__name__
|
||||
|
||||
if self.points == True:
|
||||
for point in matriz:
|
||||
Draft.makePoint(point)
|
||||
else:
|
||||
curva = Part.makePolygon(matriz)
|
||||
if self.bspline == True:
|
||||
Draft.makeBSpline(curva,closed=self.close,face=False)
|
||||
#Draft.makeBSpline(Draft.makeWire(curva,closed=self.close,face=False),closed=self.close,face=False)
|
||||
if self.bezier == True:
|
||||
Draft.makeBezCurve(curva,closed=self.close,face=False)
|
||||
if self.poly == True:
|
||||
Draft.makeWire(curva,closed=self.close,face=False)
|
||||
if self.close == True and self.face == True:
|
||||
Draft.upgrade(FreeCADGui.Selection.getSelection(),delete=True)
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
def plot_matriz(self, matriz):
|
||||
""" Plot the dataset with different options.
|
||||
"""
|
||||
if self.debug != 0:
|
||||
print self.plot_matriz.__name__
|
||||
|
||||
doc = FreeCAD.ActiveDocument
|
||||
if doc == None:
|
||||
doc = FreeCAD.newDocument()
|
||||
|
||||
if self.points == True:
|
||||
for point in matriz:
|
||||
a = Draft.makePoint(point)
|
||||
FreeCAD.ActiveDocument.ActiveObject.Label = str(a.Name)+"_Point_"+str(self.name.text())
|
||||
else:
|
||||
curva = Part.makePolygon(matriz)
|
||||
if self.bspline == True:
|
||||
a = Draft.makeBSpline(curva,closed=self.close,face=False)
|
||||
FreeCAD.ActiveDocument.ActiveObject.Label = str(a.Name)+"_BSpline_"+str(self.name.text())
|
||||
if self.bezier == True:
|
||||
a = Draft.makeBezCurve(curva,closed=self.close,face=False)
|
||||
FreeCAD.ActiveDocument.ActiveObject.Label = str(a.Name)+"_BezCurve_"+str(self.name.text())
|
||||
if self.poly == True:
|
||||
a = Draft.makeWire(curva,closed=self.close,face=False)
|
||||
FreeCAD.ActiveDocument.ActiveObject.Label = str(a.Name)+"_Wire_"+str(self.name.text())
|
||||
# if self.arcs == True:
|
||||
# s=Part.BSplineCurve()
|
||||
# s.interpolate(matriz, True)
|
||||
# s.buildFromPoles(matriz)
|
||||
# #Part.show(s.toShape())
|
||||
# arcs=s.toBiArcs(0.1)
|
||||
# wire=Part.Wire([Part.Edge(i) for i in arcs])
|
||||
# Part.show(wire)
|
||||
if self.close == True and self.face == True:
|
||||
Draft.upgrade(FreeCADGui.Selection.getSelection(),delete=True)
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
FreeCADGui.ActiveDocument.ActiveView.fitAll()
|
||||
|
||||
def edit(self):
|
||||
""" Launch the edit panel curve.
|
||||
"""
|
||||
if self.debug != 0:
|
||||
print self.edit.__name__
|
||||
|
||||
self.dialog.show()
|
||||
# self.dialog.exec_()
|
||||
|
||||
class ParametricCurve2D(Parametric):
|
||||
""" A ParametricCurve2D object
|
||||
"""
|
||||
def __init__(self, gui):
|
||||
Parametric.__init__(self, gui)
|
||||
|
||||
self.name = self.gui.ParCurve_name_2
|
||||
self.la = self.gui.ParCurve_a_2
|
||||
self.lb = self.gui.ParCurve_b_2
|
||||
self.lx = self.gui.ParCurve_x_2
|
||||
self.ly = self.gui.ParCurve_y_2
|
||||
self.ltmin = self.gui.ParCurve_tmin_2
|
||||
self.ltmax = self.gui.ParCurve_tmax_2
|
||||
self.ltstep = self.gui.ParCurve_tstep_2
|
||||
|
||||
self.lpolar = self.gui.checkBox_polar_2
|
||||
self.cb_points = self.gui.checkBox_points_2
|
||||
self.cb_polyline = self.gui.checkBox_polyline_2
|
||||
self.cb_bspline = self.gui.checkBox_bspline_2
|
||||
self.cb_bezier = self.gui.checkBox_bezier_2
|
||||
|
||||
self.cb_close = self.gui.checkBox_close_2
|
||||
self.cb_face = self.gui.checkBox_face_2
|
||||
|
||||
self.cb_face.setEnabled(False)
|
||||
self.close = False
|
||||
self.face = False
|
||||
|
||||
self.combox = self.gui.ParCurve_comboBox_2
|
||||
|
||||
self.dialog = QtGui.QDialog()
|
||||
self.dialog.resize(280,110)
|
||||
self.dialog.setWindowTitle("2D Parametric Curve Editor")
|
||||
self.dialog.ui = ParCurveEdit.tableWidget2D(database="Parametric2D.dat")
|
||||
self.dialog.ui.setupUi(self.dialog, self.combox)
|
||||
|
||||
|
||||
def updateOptions(self):
|
||||
if self.points:
|
||||
self.cb_close.setEnabled(False)
|
||||
self.cb_face.setEnabled(False)
|
||||
self.cb_close.setChecked(False)
|
||||
self.cb_face.setChecked(False)
|
||||
self.close = False
|
||||
self.face = False
|
||||
else:
|
||||
self.cb_close.setEnabled(True)
|
||||
if self.poly and self.close:
|
||||
self.cb_face.setEnabled(True)
|
||||
else:
|
||||
self.cb_face.setEnabled(False)
|
||||
self.cb_face.setChecked(False)
|
||||
self.face = False
|
||||
|
||||
|
||||
def select_curve(self, *argc):
|
||||
""" Selection of Curve by combo box.
|
||||
"""
|
||||
if self.debug != 0:
|
||||
print self.select_curve.__name__
|
||||
|
||||
m_line = self.dialog.ui.selectCurve(*argc)
|
||||
if self.debug != 0:
|
||||
print str(m_line)
|
||||
self.name.setText(str(m_line[0]))
|
||||
self.la.setText(str(m_line[1]))
|
||||
self.lb.setText(str(m_line[2]))
|
||||
self.lx.setText(str(m_line[3]))
|
||||
self.ly.setText(str(m_line[4]))
|
||||
self.ltmin.setText(str(m_line[5]))
|
||||
self.ltmax.setText(str(m_line[6]))
|
||||
self.ltstep.setText(str(m_line[7]))
|
||||
m_polar = int(str(m_line[8]))
|
||||
if self.debug != 0:
|
||||
print str(m_polar)
|
||||
print str(self.lpolar)
|
||||
self.polar = False
|
||||
if m_polar == 1:
|
||||
print str(m_polar)
|
||||
self.polar = True
|
||||
self.lpolar.setChecked(self.polar)
|
||||
|
||||
def draw(self):
|
||||
if self.debug != 0:
|
||||
print self.draw.__name__
|
||||
|
||||
msgBox = QtGui.QMessageBox()
|
||||
|
||||
fa = str(self.la.text())
|
||||
fb = str(self.lb.text())
|
||||
fx = str(self.lx.text())
|
||||
fy = str(self.ly.text())
|
||||
t = float(eval(str(self.ltmin.text())))
|
||||
tf = float(eval(str(self.ltmax.text())))
|
||||
intt = float(eval(str(self.ltstep.text())))
|
||||
|
||||
d = (tf + intt -t)/intt
|
||||
dmax = int(d)
|
||||
matriz = []
|
||||
|
||||
if self.debug != 0:
|
||||
print "t=" + str(t) +" to " + str(tf) + " with step of " + str(intt)
|
||||
print "d=" + str(d)
|
||||
print "a=" + str(fa)
|
||||
print "b=" + str(fb)
|
||||
print "x=" + str(fx)
|
||||
print "y=" + str(fy)
|
||||
|
||||
code = """
|
||||
def f(fa,fb,fx,fy,t):
|
||||
value=""
|
||||
msgBox = QtGui.QMessageBox()
|
||||
try:
|
||||
value="a() = """+str(fa)+""""
|
||||
a="""+str(fa)+"""
|
||||
value="b() = """+str(fb)+""""
|
||||
b="""+str(fb)+"""
|
||||
value="X() = """+str(fx)+""""
|
||||
fxx="""+str(fx)+"""
|
||||
value="Y() = """+str(fy)+""""
|
||||
fyy="""+str(fy)+"""
|
||||
except ZeroDivisionError:
|
||||
msgBox.setText("Error division by zero in calculus of "+value+" for (t) = "+str(t)+" !")
|
||||
msgBox.exec_()
|
||||
return
|
||||
except:
|
||||
msgBox.setText("Error in the formula of "+value+" for (t) = "+str(t)+" !")
|
||||
msgBox.exec_()
|
||||
return
|
||||
|
||||
return fxx, fyy
|
||||
"""
|
||||
#==============================================================================
|
||||
# for i in range(int(d)):
|
||||
# try:
|
||||
# value="a"
|
||||
# a=eval(fa)
|
||||
# value="b"
|
||||
# b=eval(fb)
|
||||
# value="X"
|
||||
# fxx=eval(fx)
|
||||
# value="Y"
|
||||
# fyy=eval(fy)
|
||||
# #print fxx,fyy
|
||||
# except ZeroDivisionError:
|
||||
# msgBox.setText("Error division by zero in calculus of "+value+"() for t="+str(t)+" !")
|
||||
# msgBox.exec_()
|
||||
# except:
|
||||
# msgBox.setText("Error in the formula of "+value+"() !")
|
||||
# msgBox.exec_()
|
||||
#
|
||||
# if self.polar == True:
|
||||
# matriz.append(FreeCAD.Vector(fxx*cos(fyy),fxx*sin(fyy),0.0))
|
||||
# else:
|
||||
# matriz.append(FreeCAD.Vector(fxx,fyy,0.0))
|
||||
# t+=intt
|
||||
#==============================================================================
|
||||
|
||||
if self.debug != 0:
|
||||
print code
|
||||
exec code
|
||||
|
||||
for i in range(dmax):
|
||||
fxx, fyy = f(fa,fb,fx,fy,t)
|
||||
if self.polar == True:
|
||||
matriz.append(FreeCAD.Vector(fxx*cos(fyy),fxx*sin(fyy),0.0))
|
||||
else:
|
||||
matriz.append(FreeCAD.Vector(fxx,fyy,0.0))
|
||||
t+=intt
|
||||
|
||||
self.plot_matriz(matriz)
|
||||
|
||||
|
||||
def store(self):
|
||||
""" Store the parametric curve.
|
||||
"""
|
||||
if self.debug != 0:
|
||||
print self.store.__name__
|
||||
m_line = []
|
||||
m_items = [self.name, self.la, self.lb,self.lx, self.ly,
|
||||
self.ltmin, self.ltmax, self.ltstep,]
|
||||
|
||||
for m_item in m_items:
|
||||
m_val = ""
|
||||
m_val = m_item.text()
|
||||
m_line.append(str(m_val))
|
||||
if self.polar:
|
||||
m_line.append("1")
|
||||
else:
|
||||
m_line.append("0")
|
||||
# append comment
|
||||
m_line.append("")
|
||||
print str(m_line)
|
||||
self.dialog.ui.addCurveData(m_line)
|
||||
|
||||
|
||||
class ParametricCurve3D(Parametric):
|
||||
""" A ParametricCurve3D object
|
||||
"""
|
||||
def __init__(self, gui):
|
||||
Parametric.__init__(self, gui)
|
||||
|
||||
self.name = self.gui.ParCurve_name_3
|
||||
self.la = self.gui.ParCurve_a_3
|
||||
self.lb = self.gui.ParCurve_b_3
|
||||
self.lc = self.gui.ParCurve_c_3
|
||||
self.lx = self.gui.ParCurve_x_3
|
||||
self.ly = self.gui.ParCurve_y_3
|
||||
self.lz = self.gui.ParCurve_z_3
|
||||
self.ltmin = self.gui.ParCurve_tmin_3
|
||||
self.ltmax = self.gui.ParCurve_tmax_3
|
||||
self.ltstep = self.gui.ParCurve_tstep_3
|
||||
|
||||
self.combox = self.gui.ParCurve_comboBox_3
|
||||
|
||||
self.dialog = QtGui.QDialog()
|
||||
self.dialog.resize(280,110)
|
||||
self.dialog.setWindowTitle("3D Parametric Curve Editor")
|
||||
self.dialog.ui = ParCurveEdit.tableWidget3D(database="Parametric3D.dat")
|
||||
self.dialog.ui.setupUi(self.dialog, self.combox)
|
||||
|
||||
|
||||
def select_curve(self, *argc):
|
||||
""" Selection of Curve by combo box.
|
||||
"""
|
||||
if self.debug != 0:
|
||||
print self.select_curve.__name__
|
||||
|
||||
m_line = self.dialog.ui.selectCurve(*argc)
|
||||
if self.debug != 0:
|
||||
print str(m_line)
|
||||
self.name.setText(str(m_line[0]))
|
||||
self.la.setText(str(m_line[1]))
|
||||
self.lb.setText(str(m_line[2]))
|
||||
self.lc.setText(str(m_line[3]))
|
||||
self.lx.setText(str(m_line[4]))
|
||||
self.ly.setText(str(m_line[5]))
|
||||
self.lz.setText(str(m_line[6]))
|
||||
self.ltmin.setText(str(m_line[7]))
|
||||
self.ltmax.setText(str(m_line[8]))
|
||||
self.ltstep.setText(str(m_line[9]))
|
||||
|
||||
|
||||
def draw(self):
|
||||
if self.debug != 0:
|
||||
print self.draw.__name__
|
||||
msgBox = QtGui.QMessageBox()
|
||||
fa = str(self.la.text())
|
||||
fb = str(self.lb.text())
|
||||
fc = str(self.lc.text())
|
||||
fx = str(self.lx.text())
|
||||
fy = str(self.ly.text())
|
||||
fz = str(self.lz.text())
|
||||
t = float(eval(str(self.ltmin.text())))
|
||||
tf = float(eval(str(self.ltmax.text())))
|
||||
intt = float(eval(str(self.ltstep.text())))
|
||||
|
||||
d = (tf + intt -t)/intt
|
||||
dmax = int(d)
|
||||
matriz = []
|
||||
|
||||
if self.debug != 0:
|
||||
print "t=" + str(t) +" to " + str(tf) + " with step of " + str(intt)
|
||||
print "d=" + str(d)
|
||||
print "a=" + str(fa)
|
||||
print "b=" + str(fb)
|
||||
print "c=" + str(fc)
|
||||
print "x=" + str(fx)
|
||||
print "y=" + str(fy)
|
||||
print "z=" + str(fz)
|
||||
|
||||
code = """
|
||||
def f(fa,fb,fc,fx,fy,fz,t):
|
||||
value=""
|
||||
msgBox = QtGui.QMessageBox()
|
||||
try:
|
||||
value="a() = """+str(fa)+""""
|
||||
a="""+str(fa)+"""
|
||||
value="b() = """+str(fb)+""""
|
||||
b="""+str(fb)+"""
|
||||
value="c() = """+str(fc)+""""
|
||||
c="""+str(fc)+"""
|
||||
value="X() = """+str(fx)+""""
|
||||
fxx="""+str(fx)+"""
|
||||
value="Y() = """+str(fy)+""""
|
||||
fyy="""+str(fy)+"""
|
||||
value="Z() = """+str(fz)+""""
|
||||
fzz="""+str(fz)+"""
|
||||
except ZeroDivisionError:
|
||||
msgBox.setText("Error division by zero in calculus of "+value+" for (t) = "+str(t)+" !")
|
||||
msgBox.exec_()
|
||||
return
|
||||
except:
|
||||
msgBox.setText("Error in the formula of "+value+" for (t) = "+str(t)+" !")
|
||||
msgBox.exec_()
|
||||
return
|
||||
return fxx, fyy, fzz
|
||||
"""
|
||||
#==============================================================================
|
||||
# for i in range(int(d)):
|
||||
# try:
|
||||
# value="a"
|
||||
# a=eval(fa)
|
||||
# value="b"
|
||||
# b=eval(fb)
|
||||
# value="c"
|
||||
# c=eval(fc)
|
||||
# value="X"
|
||||
# fxx=eval(fx)
|
||||
# value="Y"
|
||||
# fyy=eval(fy)
|
||||
# value="Z"
|
||||
# fzz=eval(fz)
|
||||
# except ZeroDivisionError:
|
||||
# msgBox.setText("Error division by zero in calculus of "+value+"() for t="+str(t)+" !")
|
||||
# msgBox.exec_()
|
||||
# except:
|
||||
# msgBox.setText("Error in the formula of "+value+"() !")
|
||||
# msgBox.exec_()
|
||||
# matriz.append(FreeCAD.Vector(fxx,fyy,fzz))
|
||||
# t+=intv
|
||||
#==============================================================================
|
||||
|
||||
if self.debug != 0:
|
||||
print code
|
||||
exec code
|
||||
for i in range(dmax):
|
||||
fxx, fyy, fzz = f(fa,fb,fc,fx,fy,fz,t)
|
||||
matriz.append(FreeCAD.Vector(fxx,fyy,fzz))
|
||||
t+=intt
|
||||
self.plot_matriz(matriz)
|
||||
|
||||
|
||||
def store(self):
|
||||
""" Store the parametric curve.
|
||||
"""
|
||||
if self.debug != 0:
|
||||
print self.store.__name__
|
||||
m_line = []
|
||||
m_items = [self.name, self.la, self.lb, self.lc, self.lx, self.ly, self.lz,
|
||||
self.ltmin, self.ltmax, self.ltstep,]
|
||||
for m_item in m_items:
|
||||
m_val = ""
|
||||
m_val = m_item.text()
|
||||
m_line.append(str(m_val))
|
||||
# append comment
|
||||
m_line.append("")
|
||||
print str(m_line)
|
||||
self.dialog.ui.addCurveData(m_line)
|
||||
|
||||
|
||||
class ParametricCurve2DEvents(DefineAndConnectEvents):
|
||||
def __init__(self,ui):
|
||||
self.ui = ui
|
||||
# Create Parametric Curve 2D object
|
||||
self.parcurv2D = ParametricCurve2D(self.ui)
|
||||
DefineAndConnectEvents.__init__(self, self.ui, self.parcurv2D)
|
||||
|
||||
def defineEvents(self):
|
||||
#======================================================================
|
||||
# Connect to 2D functions
|
||||
#======================================================================
|
||||
self.connections_for_slider_changed = {}
|
||||
self.connections_for_button_pressed = {
|
||||
"ParCurve_button_edit_2" : "edit",
|
||||
"ParCurve_button_apply_2" : "draw",
|
||||
"ParCurve_button_store_2" : "store",
|
||||
}
|
||||
self.connections_for_combobox_changed = {
|
||||
"ParCurve_comboBox_2" : "select_curve",
|
||||
}
|
||||
self.connections_for_checkbox_toggled = {
|
||||
"checkBox_close_2" : "ccloseState",
|
||||
"checkBox_face_2" : "cfaceState",
|
||||
"checkBox_points_2" : "cpointsState",
|
||||
"checkBox_polyline_2" : "cpolyState",
|
||||
"checkBox_bspline_2" : "cbsplineState",
|
||||
"checkBox_bezier_2" : "cbezierState",
|
||||
"checkBox_polar_2" : "cpolarState",
|
||||
}
|
||||
self.connections_for_spin_changed = {}
|
||||
self.connections_for_return_pressed = {}
|
||||
|
||||
|
||||
class ParametricCurve3DEvents(DefineAndConnectEvents):
|
||||
def __init__(self,ui):
|
||||
self.ui = ui
|
||||
# Create Parametric Curve 3D object
|
||||
self.parcurv3D = ParametricCurve3D(self.ui)
|
||||
DefineAndConnectEvents.__init__(self, self.ui, self.parcurv3D)
|
||||
|
||||
def defineEvents(self):
|
||||
#======================================================================
|
||||
# Connect to 3D functions
|
||||
#======================================================================
|
||||
self.connections_for_slider_changed = {}
|
||||
self.connections_for_button_pressed = {
|
||||
"ParCurve_button_edit_3" : "edit",
|
||||
"ParCurve_button_apply_3" : "draw",
|
||||
"ParCurve_button_store_3" : "store",
|
||||
}
|
||||
self.connections_for_combobox_changed = {
|
||||
"ParCurve_comboBox_3" : "select_curve",
|
||||
}
|
||||
self.connections_for_checkbox_toggled = {
|
||||
"checkBox_close_3" : "ccloseState",
|
||||
"checkBox_points_3" : "cpointsState",
|
||||
"checkBox_polyline_3" : "cpolyState",
|
||||
"checkBox_bspline_3" : "cbsplineState",
|
||||
"checkBox_bezier_3" : "cbezierState",
|
||||
}
|
||||
self.connections_for_spin_changed = {}
|
||||
self.connections_for_return_pressed = {}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
myObject = Parametric(None)
|
1536
WorkFeature/WF_ParCurveGui_2016.py
Normal file
1536
WorkFeature/WF_ParCurveGui_2016.py
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user