From 5af9c6589c3df3ceb46672e67255ef32c2966596 Mon Sep 17 00:00:00 2001 From: Rentlau Date: Wed, 2 Sep 2015 06:47:30 +0200 Subject: [PATCH] into "Circle" TAB : Create a normal Axis of a Face. New handle of mesh objects. To create a Normal at click location on a Face: - Click first in the view to select and object, - then push the button, - then click on a location on the selected Face. or To create several Normal of the face: - Click first in the view to select and object, - then select one or several points of the face - then push the button. (These selections can also be done into the Combined View) into "Object" TAB : Section Sweep: # Make a loft defined by a list of profiles along a wire. Will extrude/sweep a Section along a Trajectory like sweep from Part Workbench but: - the Section center (of Mass) is move at the first point of the Trajectory and; - the "plane" of the Section is rotate to be perpendicular to the Trajectory. - Select first one Section wire (Closed wire will generate volumes by default) (This Section can be a compound from sketch to realize "tube") - Select one or several wire(s) as Trajectory(ies) - Then push this button NB: You can change first: - Solid option (if toggled will generate a solid for Closed wire Section only) - isFrenet option - All option (means if the trajectory selected is a compound, all sub wires will be used for the sweep) - Transition Option (Select a Transition option in case of trajectory with several wires; Transition can be: # 0 (default), 1 (right corners) or 2 (rounded corners).) into "Align" TAB : Align the Face(s) from selected object(s) to the last Face selected. - Click first to select a Face of an object or several Faces from several objects. These objects will be moved. - Click second to select a Face to align to (the last object is fixed and will never move). Then Click the button. NB: The center of rotation is the center of the bounbing box if possible or the center of the Face. if the Face of the object selected is already aligned to the last one, a rotation of 180 deg is applied to the object. In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) Two clicks will rotate by 180 deg the moving objects. Align the Edge(s) from selected object(s) to the last Edge selected. - Click first to select an Edge of an object or several Edges from several objects. These objects will be moved. - Click second to select an Edge to align to (the last object is fixed and will never move). Then Click the button. NB: The center of rotation is the center of the bounbing box if possible or the center of the Edge. if the Edge of the object selected is already aligned to the last one, a rotation of 180 deg is applied to the object. In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) Two clicks will rotate by 180 deg the moving objects. Joint Face(s) from selected object(s) to the last Face selected. - Click first to select a Face of an object or several Faces from several objects. These objects will be moved. - Click second to select a Face to joint to (the last object is fixed and will never move). Then Click the button. Two clicks will rotate by 180 deg the moving objects. --- WorkFeature/WFGui_2015.py | 402 +++++++++----- WorkFeature/WFGui_2015.ui | 517 +++++++++++++----- WorkFeature/__init__.py | 1094 ++++++++++++++++++++++++++++++++++--- 3 files changed, 1667 insertions(+), 346 deletions(-) diff --git a/WorkFeature/WFGui_2015.py b/WorkFeature/WFGui_2015.py index c8829f3..2fbf213 100644 --- a/WorkFeature/WFGui_2015.py +++ b/WorkFeature/WFGui_2015.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'WFGui_2015_06_22.ui' +# Form implementation generated from reading ui file 'WFGui_2015_08_31.ui' # -# Created: Mon Jun 22 13:51:21 2015 +# Created: Mon Aug 31 22:01:38 2015 # by: PySide UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! @@ -71,6 +71,9 @@ class Ui_Form(object): self.radioButton_biColor.setAutoExclusive(False) self.radioButton_biColor.setObjectName(_fromUtf8("radioButton_biColor")) self.gridLayout_3.addWidget(self.radioButton_biColor, 1, 0, 1, 1) + self.radioButton_copy = QtGui.QRadioButton(self.groupBox_5) + self.radioButton_copy.setObjectName(_fromUtf8("radioButton_copy")) + self.gridLayout_3.addWidget(self.radioButton_copy, 2, 0, 1, 1) self.horizontalLayout_25 = QtGui.QHBoxLayout() self.horizontalLayout_25.setObjectName(_fromUtf8("horizontalLayout_25")) self.label_5 = QtGui.QLabel(self.groupBox_5) @@ -81,9 +84,6 @@ class Ui_Form(object): self.tolerance_edit.setObjectName(_fromUtf8("tolerance_edit")) self.horizontalLayout_25.addWidget(self.tolerance_edit) self.gridLayout_3.addLayout(self.horizontalLayout_25, 3, 0, 1, 1) - self.radioButton_copy = QtGui.QRadioButton(self.groupBox_5) - self.radioButton_copy.setObjectName(_fromUtf8("radioButton_copy")) - self.gridLayout_3.addWidget(self.radioButton_copy, 2, 0, 1, 1) self.gridLayout_14.addWidget(self.groupBox_5, 0, 0, 1, 1) self.gridLayout_5.addWidget(self.frame_3, 1, 0, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) @@ -883,8 +883,12 @@ class Ui_Form(object): self.Objects_Tab2.setEnabled(True) self.Objects_Tab2.setMinimumSize(QtCore.QSize(0, 0)) self.Objects_Tab2.setObjectName(_fromUtf8("Objects_Tab2")) - self.gridLayout_12 = QtGui.QGridLayout(self.Objects_Tab2) - self.gridLayout_12.setObjectName(_fromUtf8("gridLayout_12")) + self.gridLayout_54 = QtGui.QGridLayout(self.Objects_Tab2) + self.gridLayout_54.setObjectName(_fromUtf8("gridLayout_54")) + self.horizontalLayout_35 = QtGui.QHBoxLayout() + self.horizontalLayout_35.setObjectName(_fromUtf8("horizontalLayout_35")) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.button_boundingboxes = QtGui.QPushButton(self.Objects_Tab2) self.button_boundingboxes.setMaximumSize(QtCore.QSize(16777215, 16777215)) icon54 = QtGui.QIcon() @@ -892,7 +896,7 @@ class Ui_Form(object): self.button_boundingboxes.setIcon(icon54) self.button_boundingboxes.setIconSize(QtCore.QSize(32, 32)) self.button_boundingboxes.setObjectName(_fromUtf8("button_boundingboxes")) - self.gridLayout_12.addWidget(self.button_boundingboxes, 0, 0, 1, 1) + self.verticalLayout_2.addWidget(self.button_boundingboxes) self.button_boundingbox = QtGui.QPushButton(self.Objects_Tab2) self.button_boundingbox.setMaximumSize(QtCore.QSize(16777215, 16777215)) icon55 = QtGui.QIcon() @@ -900,7 +904,13 @@ class Ui_Form(object): self.button_boundingbox.setIcon(icon55) self.button_boundingbox.setIconSize(QtCore.QSize(32, 32)) self.button_boundingbox.setObjectName(_fromUtf8("button_boundingbox")) - self.gridLayout_12.addWidget(self.button_boundingbox, 1, 0, 1, 1) + self.verticalLayout_2.addWidget(self.button_boundingbox) + self.horizontalLayout_35.addLayout(self.verticalLayout_2) + self.checkBox_volumBB = QtGui.QCheckBox(self.Objects_Tab2) + self.checkBox_volumBB.setMaximumSize(QtCore.QSize(60, 16777215)) + self.checkBox_volumBB.setObjectName(_fromUtf8("checkBox_volumBB")) + self.horizontalLayout_35.addWidget(self.checkBox_volumBB) + self.gridLayout_54.addLayout(self.horizontalLayout_35, 0, 0, 1, 1) self.line = QtGui.QFrame(self.Objects_Tab2) self.line.setFrameShadow(QtGui.QFrame.Plain) self.line.setLineWidth(4) @@ -908,7 +918,7 @@ class Ui_Form(object): self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) - self.gridLayout_12.addWidget(self.line, 2, 0, 1, 1) + self.gridLayout_54.addWidget(self.line, 1, 0, 1, 1) self.gridLayout_6 = QtGui.QGridLayout() self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6")) self.button_cylinder_create = QtGui.QPushButton(self.Objects_Tab2) @@ -938,7 +948,7 @@ class Ui_Form(object): self.length_cylinder.setMaximumSize(QtCore.QSize(60, 16777215)) self.length_cylinder.setObjectName(_fromUtf8("length_cylinder")) self.gridLayout_6.addWidget(self.length_cylinder, 0, 2, 1, 1) - self.gridLayout_12.addLayout(self.gridLayout_6, 3, 0, 1, 1) + self.gridLayout_54.addLayout(self.gridLayout_6, 2, 0, 1, 1) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.button_cube_create = QtGui.QPushButton(self.Objects_Tab2) @@ -968,7 +978,7 @@ class Ui_Form(object): self.height_cube.setMaximumSize(QtCore.QSize(60, 16777215)) self.height_cube.setObjectName(_fromUtf8("height_cube")) self.horizontalLayout_4.addWidget(self.height_cube) - self.gridLayout_12.addLayout(self.horizontalLayout_4, 4, 0, 1, 1) + self.gridLayout_54.addLayout(self.horizontalLayout_4, 3, 0, 1, 1) self.horizontalLayout_19 = QtGui.QHBoxLayout() self.horizontalLayout_19.setObjectName(_fromUtf8("horizontalLayout_19")) self.button_sphere_create = QtGui.QPushButton(self.Objects_Tab2) @@ -988,7 +998,7 @@ class Ui_Form(object): self.diameter_sphere.setMaximumSize(QtCore.QSize(60, 16777215)) self.diameter_sphere.setObjectName(_fromUtf8("diameter_sphere")) self.horizontalLayout_19.addWidget(self.diameter_sphere) - self.gridLayout_12.addLayout(self.horizontalLayout_19, 5, 0, 1, 1) + self.gridLayout_54.addLayout(self.horizontalLayout_19, 4, 0, 1, 1) self.horizontalLayout_20 = QtGui.QHBoxLayout() self.horizontalLayout_20.setObjectName(_fromUtf8("horizontalLayout_20")) self.button_dome_create = QtGui.QPushButton(self.Objects_Tab2) @@ -1017,7 +1027,7 @@ class Ui_Form(object): self.diameter_dome.setMaximumSize(QtCore.QSize(60, 16777215)) self.diameter_dome.setObjectName(_fromUtf8("diameter_dome")) self.horizontalLayout_20.addWidget(self.diameter_dome) - self.gridLayout_12.addLayout(self.horizontalLayout_20, 6, 0, 1, 1) + self.gridLayout_54.addLayout(self.horizontalLayout_20, 5, 0, 1, 1) self.horizontalLayout_23 = QtGui.QHBoxLayout() self.horizontalLayout_23.setObjectName(_fromUtf8("horizontalLayout_23")) self.button_letter = QtGui.QPushButton(self.Objects_Tab2) @@ -1041,7 +1051,7 @@ class Ui_Form(object): self.size_letter.setMaximumSize(QtCore.QSize(50, 16777215)) self.size_letter.setObjectName(_fromUtf8("size_letter")) self.horizontalLayout_23.addWidget(self.size_letter) - self.gridLayout_12.addLayout(self.horizontalLayout_23, 7, 0, 1, 1) + self.gridLayout_54.addLayout(self.horizontalLayout_23, 6, 0, 1, 1) self.horizontalLayout_34 = QtGui.QHBoxLayout() self.horizontalLayout_34.setObjectName(_fromUtf8("horizontalLayout_34")) self.button_revolve = QtGui.QPushButton(self.Objects_Tab2) @@ -1061,12 +1071,51 @@ class Ui_Form(object): self.angle_revolve.setMaximumSize(QtCore.QSize(40, 16777215)) self.angle_revolve.setObjectName(_fromUtf8("angle_revolve")) self.horizontalLayout_34.addWidget(self.angle_revolve) - self.gridLayout_12.addLayout(self.horizontalLayout_34, 8, 0, 1, 1) - spacerItem9 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.gridLayout_12.addItem(spacerItem9, 9, 0, 1, 1) + self.gridLayout_54.addLayout(self.horizontalLayout_34, 7, 0, 1, 1) + self.frame_5 = QtGui.QFrame(self.Objects_Tab2) + self.frame_5.setFrameShape(QtGui.QFrame.StyledPanel) + self.frame_5.setFrameShadow(QtGui.QFrame.Raised) + self.frame_5.setLineWidth(3) + self.frame_5.setObjectName(_fromUtf8("frame_5")) + self.gridLayout_53 = QtGui.QGridLayout(self.frame_5) + self.gridLayout_53.setObjectName(_fromUtf8("gridLayout_53")) + self.gridLayout_12 = QtGui.QGridLayout() + self.gridLayout_12.setObjectName(_fromUtf8("gridLayout_12")) + self.checkBox_allsubselect = QtGui.QCheckBox(self.frame_5) + self.checkBox_allsubselect.setChecked(True) + self.checkBox_allsubselect.setObjectName(_fromUtf8("checkBox_allsubselect")) + self.gridLayout_12.addWidget(self.checkBox_allsubselect, 2, 0, 1, 1) + self.transition_comboBox = QtGui.QComboBox(self.frame_5) + self.transition_comboBox.setObjectName(_fromUtf8("transition_comboBox")) + self.transition_comboBox.addItem(_fromUtf8("")) + self.transition_comboBox.addItem(_fromUtf8("")) + self.transition_comboBox.addItem(_fromUtf8("")) + self.gridLayout_12.addWidget(self.transition_comboBox, 2, 1, 1, 1) + self.checkBox_solid = QtGui.QCheckBox(self.frame_5) + self.checkBox_solid.setMinimumSize(QtCore.QSize(9, 0)) + self.checkBox_solid.setMaximumSize(QtCore.QSize(60, 16777215)) + self.checkBox_solid.setChecked(True) + self.checkBox_solid.setObjectName(_fromUtf8("checkBox_solid")) + self.gridLayout_12.addWidget(self.checkBox_solid, 1, 0, 1, 1) + self.radioButton_Frenet = QtGui.QRadioButton(self.frame_5) + self.radioButton_Frenet.setChecked(True) + self.radioButton_Frenet.setAutoExclusive(False) + self.radioButton_Frenet.setObjectName(_fromUtf8("radioButton_Frenet")) + self.gridLayout_12.addWidget(self.radioButton_Frenet, 1, 1, 1, 1) + self.gridLayout_53.addLayout(self.gridLayout_12, 0, 0, 1, 1) + self.button_sweep = QtGui.QPushButton(self.frame_5) icon62 = QtGui.QIcon() - icon62.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_box.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget.addTab(self.Objects_Tab2, icon62, _fromUtf8("")) + icon62.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_Beam.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_sweep.setIcon(icon62) + self.button_sweep.setIconSize(QtCore.QSize(32, 32)) + self.button_sweep.setObjectName(_fromUtf8("button_sweep")) + self.gridLayout_53.addWidget(self.button_sweep, 1, 0, 1, 1) + self.gridLayout_54.addWidget(self.frame_5, 8, 0, 1, 1) + spacerItem9 = QtGui.QSpacerItem(17, 8, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout_54.addItem(spacerItem9, 9, 0, 1, 1) + icon63 = QtGui.QIcon() + icon63.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_box.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.tabWidget.addTab(self.Objects_Tab2, icon63, _fromUtf8("")) self.Modif_Tab = QtGui.QWidget() self.Modif_Tab.setObjectName(_fromUtf8("Modif_Tab")) self.gridLayout_11 = QtGui.QGridLayout(self.Modif_Tab) @@ -1084,9 +1133,9 @@ class Ui_Form(object): sizePolicy.setHeightForWidth(self.button_alignface2view.sizePolicy().hasHeightForWidth()) self.button_alignface2view.setSizePolicy(sizePolicy) self.button_alignface2view.setMaximumSize(QtCore.QSize(220, 16777215)) - icon63 = QtGui.QIcon() - icon63.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_viewAlignFace.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_alignface2view.setIcon(icon63) + icon64 = QtGui.QIcon() + icon64.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_viewAlignFace.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_alignface2view.setIcon(icon64) self.button_alignface2view.setIconSize(QtCore.QSize(32, 32)) self.button_alignface2view.setObjectName(_fromUtf8("button_alignface2view")) self.gridLayout_51.addWidget(self.button_alignface2view, 0, 0, 1, 1) @@ -1094,9 +1143,9 @@ class Ui_Form(object): self.horizontalLayout_32.setObjectName(_fromUtf8("horizontalLayout_32")) self.button_align_faces = QtGui.QPushButton(self.align_tab) self.button_align_faces.setMaximumSize(QtCore.QSize(220, 16777215)) - icon64 = QtGui.QIcon() - icon64.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_objectAlignFaces.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_align_faces.setIcon(icon64) + icon65 = QtGui.QIcon() + icon65.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_objectAlignFaces.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_align_faces.setIcon(icon65) self.button_align_faces.setIconSize(QtCore.QSize(32, 32)) self.button_align_faces.setObjectName(_fromUtf8("button_align_faces")) self.horizontalLayout_32.addWidget(self.button_align_faces) @@ -1115,9 +1164,9 @@ class Ui_Form(object): self.horizontalLayout_33.setObjectName(_fromUtf8("horizontalLayout_33")) self.button_align_edges = QtGui.QPushButton(self.align_tab) self.button_align_edges.setMaximumSize(QtCore.QSize(220, 16777215)) - icon65 = QtGui.QIcon() - icon65.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_objectAlignAxes.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_align_edges.setIcon(icon65) + icon66 = QtGui.QIcon() + icon66.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_objectAlignAxes.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_align_edges.setIcon(icon66) self.button_align_edges.setIconSize(QtCore.QSize(32, 32)) self.button_align_edges.setObjectName(_fromUtf8("button_align_edges")) self.horizontalLayout_33.addWidget(self.button_align_edges) @@ -1132,15 +1181,22 @@ class Ui_Form(object): self.angle_align_edges.setObjectName(_fromUtf8("angle_align_edges")) self.horizontalLayout_33.addWidget(self.angle_align_edges) self.gridLayout_51.addLayout(self.horizontalLayout_33, 2, 0, 1, 1) + spacerItem10 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout_51.addItem(spacerItem10, 5, 0, 1, 1) self.button_joint_points = QtGui.QPushButton(self.align_tab) - icon66 = QtGui.QIcon() - icon66.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_objectJointPoints.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_joint_points.setIcon(icon66) + icon67 = QtGui.QIcon() + icon67.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_objectJointPoints.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_joint_points.setIcon(icon67) self.button_joint_points.setIconSize(QtCore.QSize(32, 32)) self.button_joint_points.setObjectName(_fromUtf8("button_joint_points")) self.gridLayout_51.addWidget(self.button_joint_points, 3, 0, 1, 1) - spacerItem10 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.gridLayout_51.addItem(spacerItem10, 4, 0, 1, 1) + self.button_joint_faces = QtGui.QPushButton(self.align_tab) + icon68 = QtGui.QIcon() + icon68.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_objectJointFaces.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_joint_faces.setIcon(icon68) + self.button_joint_faces.setIconSize(QtCore.QSize(32, 32)) + self.button_joint_faces.setObjectName(_fromUtf8("button_joint_faces")) + self.gridLayout_51.addWidget(self.button_joint_faces, 4, 0, 1, 1) self.tabWidget_2.addTab(self.align_tab, _fromUtf8("")) self.cut_tab = QtGui.QWidget() self.cut_tab.setObjectName(_fromUtf8("cut_tab")) @@ -1307,9 +1363,9 @@ class Ui_Form(object): self.ObjRot_button_select_axis.setMaximumSize(QtCore.QSize(80, 16777215)) self.ObjRot_button_select_axis.setObjectName(_fromUtf8("ObjRot_button_select_axis")) self.gridLayout_21.addWidget(self.ObjRot_button_select_axis, 1, 0, 1, 1) - icon67 = QtGui.QIcon() - icon67.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_rotationAxis.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget_3.addTab(self.tab_8, icon67, _fromUtf8("")) + icon69 = QtGui.QIcon() + icon69.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_rotationAxis.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.tabWidget_3.addTab(self.tab_8, icon69, _fromUtf8("")) self.tab_9 = QtGui.QWidget() self.tab_9.setObjectName(_fromUtf8("tab_9")) self.gridLayout_23 = QtGui.QGridLayout(self.tab_9) @@ -1336,9 +1392,9 @@ class Ui_Form(object): self.ObjRot_button_select_center.setMaximumSize(QtCore.QSize(80, 16777215)) self.ObjRot_button_select_center.setObjectName(_fromUtf8("ObjRot_button_select_center")) self.gridLayout_23.addWidget(self.ObjRot_button_select_center, 1, 0, 1, 1) - icon68 = QtGui.QIcon() - icon68.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_rotationPoint.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget_3.addTab(self.tab_9, icon68, _fromUtf8("")) + icon70 = QtGui.QIcon() + icon70.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_rotationPoint.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.tabWidget_3.addTab(self.tab_9, icon70, _fromUtf8("")) self.gridLayout_50.addWidget(self.tabWidget_3, 1, 0, 1, 1) self.groupBox_2 = QtGui.QGroupBox(self.frame) self.groupBox_2.setMinimumSize(QtCore.QSize(150, 67)) @@ -1374,9 +1430,9 @@ class Ui_Form(object): self.ObjRot_button_select_angle.setMaximumSize(QtCore.QSize(80, 16777215)) self.ObjRot_button_select_angle.setObjectName(_fromUtf8("ObjRot_button_select_angle")) self.gridLayout_24.addWidget(self.ObjRot_button_select_angle, 0, 0, 1, 1) - icon69 = QtGui.QIcon() - icon69.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_click.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget_5.addTab(self.tab_10, icon69, _fromUtf8("")) + icon71 = QtGui.QIcon() + icon71.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_click.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.tabWidget_5.addTab(self.tab_10, icon71, _fromUtf8("")) self.gridLayout_29.addWidget(self.tabWidget_5, 0, 0, 1, 1) self.horizontalLayout_13 = QtGui.QHBoxLayout() self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13")) @@ -1441,7 +1497,7 @@ class Ui_Form(object): self.ObjTrans_spin.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons) self.ObjTrans_spin.setKeyboardTracking(False) self.ObjTrans_spin.setMinimum(1) - self.ObjTrans_spin.setMaximum(10) + self.ObjTrans_spin.setMaximum(20) self.ObjTrans_spin.setSingleStep(1) self.ObjTrans_spin.setProperty("value", 1) self.ObjTrans_spin.setObjectName(_fromUtf8("ObjTrans_spin")) @@ -1525,9 +1581,9 @@ class Ui_Form(object): self.gridLayout_27.addLayout(self.gridLayout_41, 2, 0, 1, 1) self.gridLayout_26.addLayout(self.gridLayout_27, 2, 0, 1, 1) self.gridLayout_15.addWidget(self.groupBox_3, 0, 0, 1, 1) - icon70 = QtGui.QIcon() - icon70.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_startPoint.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget_4.addTab(self.tab_5, icon70, _fromUtf8("")) + icon72 = QtGui.QIcon() + icon72.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_startPoint.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.tabWidget_4.addTab(self.tab_5, icon72, _fromUtf8("")) self.tab_6 = QtGui.QWidget() self.tab_6.setObjectName(_fromUtf8("tab_6")) self.gridLayout_42 = QtGui.QGridLayout(self.tab_6) @@ -1602,9 +1658,9 @@ class Ui_Form(object): self.gridLayout_44.addLayout(self.gridLayout_47, 0, 0, 1, 1) self.gridLayout_43.addLayout(self.gridLayout_44, 2, 0, 1, 1) self.gridLayout_42.addWidget(self.groupBox_4, 0, 0, 1, 1) - icon71 = QtGui.QIcon() - icon71.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_endPoint.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget_4.addTab(self.tab_6, icon71, _fromUtf8("")) + icon73 = QtGui.QIcon() + icon73.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_endPoint.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.tabWidget_4.addTab(self.tab_6, icon73, _fromUtf8("")) self.gridLayout_48.addWidget(self.tabWidget_4, 2, 0, 1, 1) self.horizontalLayout_16 = QtGui.QHBoxLayout() self.horizontalLayout_16.setObjectName(_fromUtf8("horizontalLayout_16")) @@ -1638,96 +1694,96 @@ class Ui_Form(object): sizePolicy.setHeightForWidth(self.button_alignview.sizePolicy().hasHeightForWidth()) self.button_alignview.setSizePolicy(sizePolicy) self.button_alignview.setMaximumSize(QtCore.QSize(16777215, 16777215)) - icon72 = QtGui.QIcon() - icon72.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_viewAlign.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_alignview.setIcon(icon72) + icon74 = QtGui.QIcon() + icon74.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_viewAlign.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_alignview.setIcon(icon74) self.button_alignview.setIconSize(QtCore.QSize(32, 32)) self.button_alignview.setObjectName(_fromUtf8("button_alignview")) self.gridLayout_13.addWidget(self.button_alignview, 0, 0, 1, 1) spacerItem17 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout_13.addItem(spacerItem17, 2, 0, 1, 1) self.button_trackcamera = QtGui.QPushButton(self.View_Tab) - icon73 = QtGui.QIcon() - icon73.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_trackCamera.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_trackcamera.setIcon(icon73) + icon75 = QtGui.QIcon() + icon75.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_trackCamera.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_trackcamera.setIcon(icon75) self.button_trackcamera.setIconSize(QtCore.QSize(32, 32)) self.button_trackcamera.setObjectName(_fromUtf8("button_trackcamera")) self.gridLayout_13.addWidget(self.button_trackcamera, 1, 0, 1, 1) - icon74 = QtGui.QIcon() - icon74.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_view.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget.addTab(self.View_Tab, icon74, _fromUtf8("")) + icon76 = QtGui.QIcon() + icon76.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_view.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.tabWidget.addTab(self.View_Tab, icon76, _fromUtf8("")) self.tab_3 = QtGui.QWidget() self.tab_3.setObjectName(_fromUtf8("tab_3")) self.gridLayout_35 = QtGui.QGridLayout(self.tab_3) self.gridLayout_35.setObjectName(_fromUtf8("gridLayout_35")) self.button_isView = QtGui.QPushButton(self.tab_3) - icon75 = QtGui.QIcon() - icon75.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_FCCamera_02.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isView.setIcon(icon75) + icon77 = QtGui.QIcon() + icon77.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_FCCamera_02.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isView.setIcon(icon77) self.button_isView.setIconSize(QtCore.QSize(32, 32)) self.button_isView.setObjectName(_fromUtf8("button_isView")) self.gridLayout_35.addWidget(self.button_isView, 8, 0, 1, 1) spacerItem18 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout_35.addItem(spacerItem18, 9, 0, 1, 1) - self.button_isParallel = QtGui.QPushButton(self.tab_3) - icon76 = QtGui.QIcon() - icon76.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isParallel.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isParallel.setIcon(icon76) - self.button_isParallel.setIconSize(QtCore.QSize(32, 32)) - self.button_isParallel.setObjectName(_fromUtf8("button_isParallel")) - self.gridLayout_35.addWidget(self.button_isParallel, 0, 0, 1, 1) self.button_isCoplanar = QtGui.QPushButton(self.tab_3) - icon77 = QtGui.QIcon() - icon77.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isCoplanar.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isCoplanar.setIcon(icon77) + icon78 = QtGui.QIcon() + icon78.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isCoplanar.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isCoplanar.setIcon(icon78) self.button_isCoplanar.setIconSize(QtCore.QSize(32, 32)) self.button_isCoplanar.setObjectName(_fromUtf8("button_isCoplanar")) self.gridLayout_35.addWidget(self.button_isCoplanar, 2, 0, 1, 1) + self.button_isParallel = QtGui.QPushButton(self.tab_3) + icon79 = QtGui.QIcon() + icon79.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isParallel.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isParallel.setIcon(icon79) + self.button_isParallel.setIconSize(QtCore.QSize(32, 32)) + self.button_isParallel.setObjectName(_fromUtf8("button_isParallel")) + self.gridLayout_35.addWidget(self.button_isParallel, 0, 0, 1, 1) self.button_isAngle = QtGui.QPushButton(self.tab_3) - icon78 = QtGui.QIcon() - icon78.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_angleBetween.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isAngle.setIcon(icon78) + icon80 = QtGui.QIcon() + icon80.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_angleBetween.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isAngle.setIcon(icon80) self.button_isAngle.setIconSize(QtCore.QSize(32, 32)) self.button_isAngle.setObjectName(_fromUtf8("button_isAngle")) self.gridLayout_35.addWidget(self.button_isAngle, 4, 0, 1, 1) self.button_isLength = QtGui.QPushButton(self.tab_3) - icon79 = QtGui.QIcon() - icon79.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isLength.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isLength.setIcon(icon79) + icon81 = QtGui.QIcon() + icon81.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isLength.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isLength.setIcon(icon81) self.button_isLength.setIconSize(QtCore.QSize(32, 32)) self.button_isLength.setObjectName(_fromUtf8("button_isLength")) self.gridLayout_35.addWidget(self.button_isLength, 6, 0, 1, 1) - self.button_isPerpendicular = QtGui.QPushButton(self.tab_3) - icon80 = QtGui.QIcon() - icon80.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isPerpendicular.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isPerpendicular.setIcon(icon80) - self.button_isPerpendicular.setIconSize(QtCore.QSize(32, 32)) - self.button_isPerpendicular.setObjectName(_fromUtf8("button_isPerpendicular")) - self.gridLayout_35.addWidget(self.button_isPerpendicular, 1, 0, 1, 1) self.button_isDistance = QtGui.QPushButton(self.tab_3) - icon81 = QtGui.QIcon() - icon81.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_distanceBetween.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isDistance.setIcon(icon81) + icon82 = QtGui.QIcon() + icon82.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_distanceBetween.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isDistance.setIcon(icon82) self.button_isDistance.setIconSize(QtCore.QSize(32, 32)) self.button_isDistance.setObjectName(_fromUtf8("button_isDistance")) self.gridLayout_35.addWidget(self.button_isDistance, 5, 0, 1, 1) + self.button_isPerpendicular = QtGui.QPushButton(self.tab_3) + icon83 = QtGui.QIcon() + icon83.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isPerpendicular.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isPerpendicular.setIcon(icon83) + self.button_isPerpendicular.setIconSize(QtCore.QSize(32, 32)) + self.button_isPerpendicular.setObjectName(_fromUtf8("button_isPerpendicular")) + self.gridLayout_35.addWidget(self.button_isPerpendicular, 1, 0, 1, 1) self.button_isClearance = QtGui.QPushButton(self.tab_3) - icon82 = QtGui.QIcon() - icon82.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isClearance.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isClearance.setIcon(icon82) + icon84 = QtGui.QIcon() + icon84.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isClearance.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isClearance.setIcon(icon84) self.button_isClearance.setIconSize(QtCore.QSize(32, 32)) self.button_isClearance.setObjectName(_fromUtf8("button_isClearance")) self.gridLayout_35.addWidget(self.button_isClearance, 3, 0, 1, 1) self.button_isArea = QtGui.QPushButton(self.tab_3) - icon83 = QtGui.QIcon() - icon83.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isArea.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.button_isArea.setIcon(icon83) + icon85 = QtGui.QIcon() + icon85.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_isArea.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.button_isArea.setIcon(icon85) self.button_isArea.setIconSize(QtCore.QSize(32, 32)) self.button_isArea.setObjectName(_fromUtf8("button_isArea")) self.gridLayout_35.addWidget(self.button_isArea, 7, 0, 1, 1) - icon84 = QtGui.QIcon() - icon84.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_check.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget.addTab(self.tab_3, icon84, _fromUtf8("")) + icon86 = QtGui.QIcon() + icon86.addPixmap(QtGui.QPixmap(_fromUtf8("icons:WF_check.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.tabWidget.addTab(self.tab_3, icon86, _fromUtf8("")) self.gridLayout_30.addWidget(self.tabWidget, 0, 0, 1, 1) self.tabWidget_0.addTab(self.tab_2, _fromUtf8("")) self.gridLayout_9.addWidget(self.tabWidget_0, 0, 0, 1, 1) @@ -1749,7 +1805,8 @@ class Ui_Form(object): self.tabWidget_0.setCurrentIndex(0) self.tabWidget.setCurrentIndex(0) self.point_loc_comboBox.setCurrentIndex(1) - self.tabWidget_2.setCurrentIndex(2) + self.transition_comboBox.setCurrentIndex(2) + self.tabWidget_2.setCurrentIndex(0) self.tabWidget_3.setCurrentIndex(0) self.ObjRot_comboBox_axis.setCurrentIndex(0) self.ObjRot_comboBox_center.setCurrentIndex(2) @@ -1773,6 +1830,15 @@ class Ui_Form(object): " Arcs=Cut(Circle) \n" "", None, QtGui.QApplication.UnicodeUTF8)) self.radioButton_biColor.setText(QtGui.QApplication.translate("Form", "Bi Color", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButton_copy.setToolTip(QtGui.QApplication.translate("Form", "Force the duplication of the Parent Object for the following functions:\n" +" - in \"Axis 2/2\" TAB:\n" +" Axes=(Axis,Pt,dist)\n" +" If an Edge of a Cube is selected the Cube is duplicate \n" +" with the corresponding\n" +" Edge at the defined distance from the original.\n" +" - in \"Plane\" TAB:\n" +" Plane=(Plane,dist) ", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButton_copy.setText(QtGui.QApplication.translate("Form", "Object copy", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setToolTip(QtGui.QApplication.translate("Form", "Change the tolerance for the following functions:\n" " - in \"Check\" TAB:\n" " are Parallel?\n" @@ -1785,15 +1851,6 @@ class Ui_Form(object): " are Perpendicular?\n" " are Coplanar?", None, QtGui.QApplication.UnicodeUTF8)) self.tolerance_edit.setText(QtGui.QApplication.translate("Form", "1e-10", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_copy.setToolTip(QtGui.QApplication.translate("Form", "Force the duplication of the Parent Object for the following functions:\n" -" - in \"Axis 2/2\" TAB:\n" -" Axes=(Axis,Pt,dist)\n" -" If an Edge of a Cube is selected the Cube is duplicate \n" -" with the corresponding\n" -" Edge at the defined distance from the original.\n" -" - in \"Plane\" TAB:\n" -" Plane=(Plane,dist) ", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_copy.setText(QtGui.QApplication.translate("Form", "Object copy", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.Origin_Tab), QtGui.QApplication.translate("Form", "Ori. Pref.", None, QtGui.QApplication.UnicodeUTF8)) self.button_point_line_point.setToolTip(QtGui.QApplication.translate("Form", "Point(s)=(Point(s),Line(s)):\n" "Create projection(s) of Point(s) onto Line(s).\n" @@ -1833,11 +1890,16 @@ class Ui_Form(object): " if BBox is not toggled\n" " This point is the MEAN location of all center of Mass (if exist) of all objects.\n" " All center of Mass will be created too.\n" -" if BBox is toggled\n" +" \n" +"if BBox check box is toggled\n" " This point is the center of the Global X,Y,Z bounding box of all objects.\n" " This bounding box alway exists (especially for draft objects).\n" " Be aware this point is not necessary the center of Mass of all Objects!", None, QtGui.QApplication.UnicodeUTF8)) self.button_object_center.setText(QtGui.QApplication.translate("Form", "Object(s) Center", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_object_center.setToolTip(QtGui.QApplication.translate("Form", "if BBox check box is toggled\n" +" This point is the center of the Global X,Y,Z bounding box of all objects.\n" +" This bounding box alway exists (especially for draft objects).\n" +" Be aware this point is not necessary the center of Mass of all Objects!", None, QtGui.QApplication.UnicodeUTF8)) self.checkBox_object_center.setText(QtGui.QApplication.translate("Form", "BBox", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.Point_Tab1), QtGui.QApplication.translate("Form", "Point 1/2", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabToolTip(self.tabWidget.indexOf(self.Point_Tab1), QtGui.QApplication.translate("Form", "Point", None, QtGui.QApplication.UnicodeUTF8)) @@ -1912,10 +1974,17 @@ class Ui_Form(object): "NB: Axes are created on both sides of the Plane\n" "The extension is 10 units by defaut but must be changed if needed.", None, QtGui.QApplication.UnicodeUTF8)) self.button_plane_axis.setText(QtGui.QApplication.translate("Form", "Plane(s) Axes", None, QtGui.QApplication.UnicodeUTF8)) - self.button_face_normal.setToolTip(QtGui.QApplication.translate("Form", "Create a normal Axis at click location of a Face.\n" -"Click first in the view to select and object,\n" -"then push the button, \n" -"then click on a location on the selected object.", None, QtGui.QApplication.UnicodeUTF8)) + self.button_face_normal.setToolTip(QtGui.QApplication.translate("Form", "Create a normal Axis of a Face.\n" +"To create a Normal at click location on a Face:\n" +"- Click first in the view to select and object,\n" +"- then push the button, \n" +"- then click on a location on the selected Face.\n" +"or\n" +"To create several Normal of the face:\n" +"- Click first in the view to select and object,\n" +"- then select one or several points of the face\n" +"- then push the button.\n" +"(These selections can also be done into the Combined View)", None, QtGui.QApplication.UnicodeUTF8)) self.button_face_normal.setText(QtGui.QApplication.translate("Form", "Face Normal", None, QtGui.QApplication.UnicodeUTF8)) self.extension_face_normal.setToolTip(QtGui.QApplication.translate("Form", "Length of external part of the (Normal) Axis.\n" " If zero In case of cylinder axis the extension will be a percentage of the object length.\n" @@ -2173,10 +2242,15 @@ class Ui_Form(object): self.extension_plane.setToolTip(QtGui.QApplication.translate("Form", "Extension of the Plane in each dimension in percentage.", None, QtGui.QApplication.UnicodeUTF8)) self.extension_plane.setText(QtGui.QApplication.translate("Form", "50.0", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.Plane_Tab11), QtGui.QApplication.translate("Form", "Plane 2/2", None, QtGui.QApplication.UnicodeUTF8)) - self.button_boundingboxes.setToolTip(QtGui.QApplication.translate("Form", "Create bounding boxes around each of selected object(s).", None, QtGui.QApplication.UnicodeUTF8)) + self.button_boundingboxes.setToolTip(QtGui.QApplication.translate("Form", "Create bounding boxes around each of selected object(s).\n" +"6 rectangles at the limits of each bounding boxes will be created.", None, QtGui.QApplication.UnicodeUTF8)) self.button_boundingboxes.setText(QtGui.QApplication.translate("Form", "Bounding Box(es)", None, QtGui.QApplication.UnicodeUTF8)) - self.button_boundingbox.setToolTip(QtGui.QApplication.translate("Form", "Create one bounding box around all of selected object(s).", None, QtGui.QApplication.UnicodeUTF8)) + self.button_boundingbox.setToolTip(QtGui.QApplication.translate("Form", "Create one bounding box around all of selected object(s).\n" +"6 rectangles at the limits of the bounding box will be created.", None, QtGui.QApplication.UnicodeUTF8)) self.button_boundingbox.setText(QtGui.QApplication.translate("Form", "Bounding Box", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_volumBB.setToolTip(QtGui.QApplication.translate("Form", "if \"Vol.\" is toggled:\n" +" In Addition of rectangles, the Bounding box will be also created as a Volume.", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_volumBB.setText(QtGui.QApplication.translate("Form", "Vol.", None, QtGui.QApplication.UnicodeUTF8)) self.button_cylinder_create.setToolTip(QtGui.QApplication.translate("Form", "Create a Cylinder aligned on Axes:\n" "- First select one or several couple of ( Axis and a Ref. Point). \n" "- Define Diameter and Length if needed.\n" @@ -2259,9 +2333,51 @@ class Ui_Form(object): self.button_revolve.setText(QtGui.QApplication.translate("Form", "Revolve", None, QtGui.QApplication.UnicodeUTF8)) self.angle_revolve.setToolTip(QtGui.QApplication.translate("Form", "Angle of the revolution in degrees.", None, QtGui.QApplication.UnicodeUTF8)) self.angle_revolve.setText(QtGui.QApplication.translate("Form", "360", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_allsubselect.setToolTip(QtGui.QApplication.translate("Form", "if \"All\" is toggled:\n" +" All the wires of the Trajectory selected will be considered.\n" +"\n" +"Untoggled if you select a Skecth with several curves and you want to process\n" +"only the one subselected.", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_allsubselect.setText(QtGui.QApplication.translate("Form", "All", None, QtGui.QApplication.UnicodeUTF8)) + self.transition_comboBox.setToolTip(QtGui.QApplication.translate("Form", "For the function :\n" +"makePipeShell(shapeList,[isSolid,isFrenet,transition])\n" +"Select a Transition option in case of trajectory with several wires; Transition can be:\n" +"# 0 (default), 1 (right corners) or 2 (rounded corners).", None, QtGui.QApplication.UnicodeUTF8)) + self.transition_comboBox.setItemText(0, QtGui.QApplication.translate("Form", "No Transition", None, QtGui.QApplication.UnicodeUTF8)) + self.transition_comboBox.setItemText(1, QtGui.QApplication.translate("Form", "Right corners", None, QtGui.QApplication.UnicodeUTF8)) + self.transition_comboBox.setItemText(2, QtGui.QApplication.translate("Form", "Rounded corners", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_solid.setToolTip(QtGui.QApplication.translate("Form", "if \"Solid\" is toggled:\n" +" The Beam sweep will generate a solid with a closed selected wire as Section.\n" +"If this check box is toggle off:\n" +" Or if the Section wire is not closed, only a shell will be created.", None, QtGui.QApplication.UnicodeUTF8)) + self.checkBox_solid.setText(QtGui.QApplication.translate("Form", "Solid", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButton_Frenet.setToolTip(QtGui.QApplication.translate("Form", "Force the \"isFrenet\" parameter to True for the function :\n" +"makePipeShell(shapeList,[isSolid,isFrenet,transition])\n" +"", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButton_Frenet.setText(QtGui.QApplication.translate("Form", "isFrenet", None, QtGui.QApplication.UnicodeUTF8)) + self.button_sweep.setToolTip(QtGui.QApplication.translate("Form", "Section Sweep:\n" +"# Make a loft defined by a list of profiles along a wire.\n" +"Will extrude/sweep a Section along a Trajectory like sweep from Part Workbench but:\n" +"- the Section center (of Mass) is move at the first point of the Trajectory and;\n" +"- the \"plane\" of the Section is rotate to be perpendicular to the Trajectory.\n" +"\n" +"- Select first one Section wire (Closed wire will generate volumes by default)\n" +"(This Section can be a compound from sketch to realize \"tube\")\n" +"- Select one or several wire(s) as Trajectory(ies)\n" +"- Then push this button\n" +"\n" +"NB: You can change first:\n" +"- Solid option (if toggled will generate a solid for Closed wire Section only) \n" +"- isFrenet option\n" +"- All option (means if the trajectory selected is a compound, all sub wires will be used for the sweep)\n" +"- Transition Option (Select a Transition option in case of trajectory with several wires; Transition can be:\n" +"# 0 (default), 1 (right corners) or 2 (rounded corners).)\n" +"", None, QtGui.QApplication.UnicodeUTF8)) + self.button_sweep.setText(QtGui.QApplication.translate("Form", "Section Sweep", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.Objects_Tab2), QtGui.QApplication.translate("Form", "Object", None, QtGui.QApplication.UnicodeUTF8)) self.button_alignface2view.setToolTip(QtGui.QApplication.translate("Form", "Align the face of selected object(s) to the actual view Plane.\n" " - Click first to select a Face of one or several objects.\n" +"These objects will be moved not the point of view.\n" "Then Click the button.\n" "\n" "NB:\n" @@ -2271,11 +2387,15 @@ class Ui_Form(object): " if the Face of the object selected is already aligned to the view Plane,\n" " a rotation of 180 deg is applied to the object.\n" " In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1)\n" +"\n" +" Two clicks will rotate by 180 deg the moving objects.\n" +"\n" "", None, QtGui.QApplication.UnicodeUTF8)) self.button_alignface2view.setText(QtGui.QApplication.translate("Form", "Align Face to View", None, QtGui.QApplication.UnicodeUTF8)) self.button_align_faces.setToolTip(QtGui.QApplication.translate("Form", "Align the Face(s) from selected object(s) to the last Face selected.\n" " - Click first to select a Face of an object or several Faces from several objects. \n" -" - Click second to select a Face to align to.\n" +"These objects will be moved.\n" +" - Click second to select a Face to align to (the last object is fixed and will never move).\n" "Then Click the button.\n" "\n" "NB:\n" @@ -2284,13 +2404,17 @@ class Ui_Form(object): " \n" " if the Face of the object selected is already aligned to the last one,\n" " a rotation of 180 deg is applied to the object.\n" -" In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1)", None, QtGui.QApplication.UnicodeUTF8)) +" In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1)\n" +"\n" +" Two clicks will rotate by 180 deg the moving objects.\n" +"", None, QtGui.QApplication.UnicodeUTF8)) self.button_align_faces.setText(QtGui.QApplication.translate("Form", "Align Faces", None, QtGui.QApplication.UnicodeUTF8)) self.angle_align_faces.setToolTip(QtGui.QApplication.translate("Form", "This Angle (in degrees) will be added to the angle needed to align Faces.", None, QtGui.QApplication.UnicodeUTF8)) self.angle_align_faces.setText(QtGui.QApplication.translate("Form", "0.0", None, QtGui.QApplication.UnicodeUTF8)) self.button_align_edges.setToolTip(QtGui.QApplication.translate("Form", "Align the Edge(s) from selected object(s) to the last Edge selected.\n" " - Click first to select an Edge of an object or several Edges from several objects. \n" -" - Click second to select an Edge to align to.\n" +"These objects will be moved.\n" +" - Click second to select an Edge to align to (the last object is fixed and will never move).\n" "Then Click the button.\n" "\n" "NB:\n" @@ -2299,16 +2423,30 @@ class Ui_Form(object): " \n" " if the Edge of the object selected is already aligned to the last one,\n" " a rotation of 180 deg is applied to the object.\n" -" In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1)", None, QtGui.QApplication.UnicodeUTF8)) +" In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1)\n" +"\n" +" Two clicks will rotate by 180 deg the moving objects.\n" +"", None, QtGui.QApplication.UnicodeUTF8)) self.button_align_edges.setText(QtGui.QApplication.translate("Form", "Align Edges", None, QtGui.QApplication.UnicodeUTF8)) self.angle_align_edges.setToolTip(QtGui.QApplication.translate("Form", "This Angle (in degrees) will be added to the angle needed to align Edges.", None, QtGui.QApplication.UnicodeUTF8)) self.angle_align_edges.setText(QtGui.QApplication.translate("Form", "0.0", None, QtGui.QApplication.UnicodeUTF8)) self.button_joint_points.setToolTip(QtGui.QApplication.translate("Form", "Joint Point(s) from selected object(s) to the last Point selected.\n" -" - Click first to select a Point of an object or several Points from several objects. \n" -" - Click second to select an Point to joint to.\n" +" - Click first to select a Point of an object or several Points from several objects.\n" +"These objects will be moved. \n" +" - Click second to select an Point to joint to (the last object is fixed and will never move).\n" "Then Click the button.\n" +"\n" "", None, QtGui.QApplication.UnicodeUTF8)) self.button_joint_points.setText(QtGui.QApplication.translate("Form", "Joint Points", None, QtGui.QApplication.UnicodeUTF8)) + self.button_joint_faces.setToolTip(QtGui.QApplication.translate("Form", "Joint Face(s) from selected object(s) to the last Face selected.\n" +" - Click first to select a Face of an object or several Faces from several objects. \n" +"These objects will be moved.\n" +" - Click second to select a Face to joint to (the last object is fixed and will never move).\n" +"Then Click the button.\n" +"\n" +" Two clicks will rotate by 180 deg the moving objects.\n" +"", None, QtGui.QApplication.UnicodeUTF8)) + self.button_joint_faces.setText(QtGui.QApplication.translate("Form", "Joint Faces", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.align_tab), QtGui.QApplication.translate("Form", "Align", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_6.setTitle(QtGui.QApplication.translate("Form", "Object", None, QtGui.QApplication.UnicodeUTF8)) self.button_cut_select_object.setToolTip(QtGui.QApplication.translate("Form", "Select the Object to cut:\n" @@ -2486,18 +2624,18 @@ class Ui_Form(object): "The returned value is the value provided \n" "by the function getCameraOrientation().", None, QtGui.QApplication.UnicodeUTF8)) self.button_isView.setText(QtGui.QApplication.translate("Form", "View ?", None, QtGui.QApplication.UnicodeUTF8)) - self.button_isParallel.setToolTip(QtGui.QApplication.translate("Form", "Check if two faces or two Edges are Parallel:\n" -"- Select the 2 faces/planes or 2 Edges/Lines and\n" -"Click this button\n" -"\n" -"NB: You can change the tolerance in \"Ori. Pref.\" TAB", None, QtGui.QApplication.UnicodeUTF8)) - self.button_isParallel.setText(QtGui.QApplication.translate("Form", "are Parallel ?", None, QtGui.QApplication.UnicodeUTF8)) self.button_isCoplanar.setToolTip(QtGui.QApplication.translate("Form", "Check if two faces or two Edges are Coplanar:\n" "- Select the 2 faces/planes or 2 Edges/Lines and\n" "Click this button\n" "\n" "NB: You can change the tolerance in \"Ori. Pref.\" TAB", None, QtGui.QApplication.UnicodeUTF8)) self.button_isCoplanar.setText(QtGui.QApplication.translate("Form", "are Coplanar ?", None, QtGui.QApplication.UnicodeUTF8)) + self.button_isParallel.setToolTip(QtGui.QApplication.translate("Form", "Check if two faces or two Edges are Parallel:\n" +"- Select the 2 faces/planes or 2 Edges/Lines and\n" +"Click this button\n" +"\n" +"NB: You can change the tolerance in \"Ori. Pref.\" TAB", None, QtGui.QApplication.UnicodeUTF8)) + self.button_isParallel.setText(QtGui.QApplication.translate("Form", "are Parallel ?", None, QtGui.QApplication.UnicodeUTF8)) self.button_isAngle.setToolTip(QtGui.QApplication.translate("Form", "Check for two Edges/Planes angle:\n" "Angle measurement between two Edges or two Planes\n" "- Select the 2 Edges and\n" @@ -2518,18 +2656,18 @@ class Ui_Form(object): "Click this button\n" " ", None, QtGui.QApplication.UnicodeUTF8)) self.button_isLength.setText(QtGui.QApplication.translate("Form", "Length ?", None, QtGui.QApplication.UnicodeUTF8)) - self.button_isPerpendicular.setToolTip(QtGui.QApplication.translate("Form", "Check if two faces or two Edges are Perpendicular:\n" -"- Select the 2 faces/planes or 2 Edges/Lines and\n" -"Click this button\n" -"\n" -"NB: You can change the tolerance in \"Ori. Pref.\" TAB", None, QtGui.QApplication.UnicodeUTF8)) - self.button_isPerpendicular.setText(QtGui.QApplication.translate("Form", "are Perpendicular ?", None, QtGui.QApplication.UnicodeUTF8)) self.button_isDistance.setToolTip(QtGui.QApplication.translate("Form", "Check for two Points distance:\n" "Distances measurement and Delta values (on main Axes) between two Points\n" "- Select the 2 Points and\n" "Click this button\n" " ", None, QtGui.QApplication.UnicodeUTF8)) self.button_isDistance.setText(QtGui.QApplication.translate("Form", "Distance ?", None, QtGui.QApplication.UnicodeUTF8)) + self.button_isPerpendicular.setToolTip(QtGui.QApplication.translate("Form", "Check if two faces or two Edges are Perpendicular:\n" +"- Select the 2 faces/planes or 2 Edges/Lines and\n" +"Click this button\n" +"\n" +"NB: You can change the tolerance in \"Ori. Pref.\" TAB", None, QtGui.QApplication.UnicodeUTF8)) + self.button_isPerpendicular.setText(QtGui.QApplication.translate("Form", "are Perpendicular ?", None, QtGui.QApplication.UnicodeUTF8)) self.button_isClearance.setToolTip(QtGui.QApplication.translate("Form", "Check for two Objects Clearance distance:\n" "Quick measurements between parallel faces and similarly placed objects\n" "- Select the 2 Objects and\n" diff --git a/WorkFeature/WFGui_2015.ui b/WorkFeature/WFGui_2015.ui index 440a9c1..3577e78 100644 --- a/WorkFeature/WFGui_2015.ui +++ b/WorkFeature/WFGui_2015.ui @@ -144,6 +144,23 @@ + + + + Force the duplication of the Parent Object for the following functions: + - in "Axis 2/2" TAB: + Axes=(Axis,Pt,dist) + If an Edge of a Cube is selected the Cube is duplicate + with the corresponding + Edge at the defined distance from the original. + - in "Plane" TAB: + Plane=(Plane,dist) + + + Object copy + + + @@ -182,23 +199,6 @@ - - - - Force the duplication of the Parent Object for the following functions: - - in "Axis 2/2" TAB: - Axes=(Axis,Pt,dist) - If an Edge of a Cube is selected the Cube is duplicate - with the corresponding - Edge at the defined distance from the original. - - in "Plane" TAB: - Plane=(Plane,dist) - - - Object copy - - - @@ -469,7 +469,8 @@ The Vector TC is perpendicular to the plane. if BBox is not toggled This point is the MEAN location of all center of Mass (if exist) of all objects. All center of Mass will be created too. - if BBox is toggled + +if BBox check box is toggled This point is the center of the Global X,Y,Z bounding box of all objects. This bounding box alway exists (especially for draft objects). Be aware this point is not necessary the center of Mass of all Objects! @@ -491,6 +492,12 @@ The Vector TC is perpendicular to the plane. + + if BBox check box is toggled + This point is the center of the Global X,Y,Z bounding box of all objects. + This bounding box alway exists (especially for draft objects). + Be aware this point is not necessary the center of Mass of all Objects! + BBox @@ -1021,10 +1028,17 @@ The extension is 10 units by defaut but must be changed if needed. - Create a normal Axis at click location of a Face. -Click first in the view to select and object, -then push the button, -then click on a location on the selected object. + Create a normal Axis of a Face. +To create a Normal at click location on a Face: +- Click first in the view to select and object, +- then push the button, +- then click on a location on the selected Face. +or +To create several Normal of the face: +- Click first in the view to select and object, +- then select one or several points of the face +- then push the button. +(These selections can also be done into the Combined View) Face Normal @@ -2691,60 +2705,87 @@ NB: Object - + - - - - 16777215 - 16777215 - - - - Create bounding boxes around each of selected object(s). - - - Bounding Box(es) - - - - ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_boundingBoxes.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_boundingBoxes.svg - - - - 32 - 32 - - - + + + + + + + + 16777215 + 16777215 + + + + Create bounding boxes around each of selected object(s). +6 rectangles at the limits of each bounding boxes will be created. + + + Bounding Box(es) + + + + ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_boundingBoxes.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_boundingBoxes.svg + + + + 32 + 32 + + + + + + + + + 16777215 + 16777215 + + + + Create one bounding box around all of selected object(s). +6 rectangles at the limits of the bounding box will be created. + + + Bounding Box + + + + ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_boundingBox.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_boundingBox.svg + + + + 32 + 32 + + + + + + + + + + + 60 + 16777215 + + + + if "Vol." is toggled: + In Addition of rectangles, the Bounding box will be also created as a Volume. + + + Vol. + + + + - - - - 16777215 - 16777215 - - - - Create one bounding box around all of selected object(s). - - - Bounding Box - - - - ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_boundingBox.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_boundingBox.svg - - - - 32 - 32 - - - - - QFrame::Plain @@ -2760,7 +2801,7 @@ NB: - + @@ -2847,7 +2888,7 @@ Negative value will reverse the direction from Ref. Point - + @@ -2934,7 +2975,7 @@ Negative value will reverse the direction from Ref. Point - + @@ -2991,7 +3032,7 @@ at the selected point(s). - + @@ -3085,7 +3126,7 @@ Original code from : Ulrich Brammer - + @@ -3162,7 +3203,7 @@ NB: - + @@ -3226,6 +3267,153 @@ NB: + + + + QFrame::StyledPanel + + + QFrame::Raised + + + 3 + + + + + + + + if "All" is toggled: + All the wires of the Trajectory selected will be considered. + +Untoggled if you select a Skecth with several curves and you want to process +only the one subselected. + + + All + + + true + + + + + + + For the function : +makePipeShell(shapeList,[isSolid,isFrenet,transition]) +Select a Transition option in case of trajectory with several wires; Transition can be: +# 0 (default), 1 (right corners) or 2 (rounded corners). + + + 2 + + + + No Transition + + + + + Right corners + + + + + Rounded corners + + + + + + + + + 9 + 0 + + + + + 60 + 16777215 + + + + if "Solid" is toggled: + The Beam sweep will generate a solid with a closed selected wire as Section. +If this check box is toggle off: + Or if the Section wire is not closed, only a shell will be created. + + + Solid + + + true + + + + + + + Force the "isFrenet" parameter to True for the function : +makePipeShell(shapeList,[isSolid,isFrenet,transition]) + + + + isFrenet + + + true + + + false + + + + + + + + + Section Sweep: +# Make a loft defined by a list of profiles along a wire. +Will extrude/sweep a Section along a Trajectory like sweep from Part Workbench but: +- the Section center (of Mass) is move at the first point of the Trajectory and; +- the "plane" of the Section is rotate to be perpendicular to the Trajectory. + +- Select first one Section wire (Closed wire will generate volumes by default) +(This Section can be a compound from sketch to realize "tube") +- Select one or several wire(s) as Trajectory(ies) +- Then push this button + +NB: You can change first: +- Solid option (if toggled will generate a solid for Closed wire Section only) +- isFrenet option +- All option (means if the trajectory selected is a compound, all sub wires will be used for the sweep) +- Transition Option (Select a Transition option in case of trajectory with several wires; Transition can be: +# 0 (default), 1 (right corners) or 2 (rounded corners).) + + + + Section Sweep + + + + ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_Beam.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_Beam.svg + + + + 32 + 32 + + + + + + + @@ -3233,8 +3421,8 @@ NB: - 20 - 40 + 17 + 8 @@ -3249,7 +3437,7 @@ NB: - 2 + 0 @@ -3273,6 +3461,7 @@ NB: Align the face of selected object(s) to the actual view Plane. - Click first to select a Face of one or several objects. +These objects will be moved not the point of view. Then Click the button. NB: @@ -3282,6 +3471,9 @@ NB: if the Face of the object selected is already aligned to the view Plane, a rotation of 180 deg is applied to the object. In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + + Two clicks will rotate by 180 deg the moving objects. + @@ -3312,7 +3504,8 @@ NB: Align the Face(s) from selected object(s) to the last Face selected. - Click first to select a Face of an object or several Faces from several objects. - - Click second to select a Face to align to. +These objects will be moved. + - Click second to select a Face to align to (the last object is fixed and will never move). Then Click the button. NB: @@ -3321,7 +3514,10 @@ NB: if the Face of the object selected is already aligned to the last one, a rotation of 180 deg is applied to the object. - In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + + Two clicks will rotate by 180 deg the moving objects. + Align Faces @@ -3381,7 +3577,8 @@ NB: Align the Edge(s) from selected object(s) to the last Edge selected. - Click first to select an Edge of an object or several Edges from several objects. - - Click second to select an Edge to align to. +These objects will be moved. + - Click second to select an Edge to align to (the last object is fixed and will never move). Then Click the button. NB: @@ -3390,7 +3587,10 @@ NB: if the Edge of the object selected is already aligned to the last one, a rotation of 180 deg is applied to the object. - In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + + Two clicks will rotate by 180 deg the moving objects. + Align Edges @@ -3437,13 +3637,28 @@ NB: + + + + Qt::Vertical + + + + 20 + 40 + + + + Joint Point(s) from selected object(s) to the last Point selected. - - Click first to select a Point of an object or several Points from several objects. - - Click second to select an Point to joint to. + - Click first to select a Point of an object or several Points from several objects. +These objects will be moved. + - Click second to select an Point to joint to (the last object is fixed and will never move). Then Click the button. + @@ -3462,17 +3677,31 @@ Then Click the button. - - - Qt::Vertical + + + Joint Face(s) from selected object(s) to the last Face selected. + - Click first to select a Face of an object or several Faces from several objects. +These objects will be moved. + - Click second to select a Face to joint to (the last object is fixed and will never move). +Then Click the button. + + Two clicks will rotate by 180 deg the moving objects. + - + + Joint Faces + + + + ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_objectJointFaces.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_objectJointFaces.svg + + - 20 - 40 + 32 + 32 - + @@ -4365,7 +4594,7 @@ N copies requested : 1 - 10 + 20 1 @@ -5038,30 +5267,6 @@ by the function getCameraOrientation(). - - - - Check if two faces or two Edges are Parallel: -- Select the 2 faces/planes or 2 Edges/Lines and -Click this button - -NB: You can change the tolerance in "Ori. Pref." TAB - - - are Parallel ? - - - - ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_isParallel.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_isParallel.svg - - - - 32 - 32 - - - - @@ -5086,6 +5291,30 @@ NB: You can change the tolerance in "Ori. Pref." TAB + + + + Check if two faces or two Edges are Parallel: +- Select the 2 faces/planes or 2 Edges/Lines and +Click this button + +NB: You can change the tolerance in "Ori. Pref." TAB + + + are Parallel ? + + + + ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_isParallel.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_isParallel.svg + + + + 32 + 32 + + + + @@ -5142,30 +5371,6 @@ Click this button - - - - Check if two faces or two Edges are Perpendicular: -- Select the 2 faces/planes or 2 Edges/Lines and -Click this button - -NB: You can change the tolerance in "Ori. Pref." TAB - - - are Perpendicular ? - - - - ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_isPerpendicular.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_isPerpendicular.svg - - - - 32 - 32 - - - - @@ -5190,6 +5395,30 @@ Click this button + + + + Check if two faces or two Edges are Perpendicular: +- Select the 2 faces/planes or 2 Edges/Lines and +Click this button + +NB: You can change the tolerance in "Ori. Pref." TAB + + + are Perpendicular ? + + + + ../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_isPerpendicular.svg../../../../../../../../home/laurent/Documents/03_Plans/Python/Icons/WF_isPerpendicular.svg + + + + 32 + 32 + + + + diff --git a/WorkFeature/__init__.py b/WorkFeature/__init__.py index 7af9e75..60e03e4 100644 --- a/WorkFeature/__init__.py +++ b/WorkFeature/__init__.py @@ -58,7 +58,7 @@ if not sys.path.__contains__("/usr/lib/freecad/lib"): import WFGui_2015 as WFGui from WF_ObjRot_2015 import * global myRelease -myRelease = "2015_06_22" +myRelease = "2015_09_02" import os.path import time @@ -104,6 +104,17 @@ biColor=0 global objCopy objCopy=0 +global sweep_solid +sweep_solid = True +global sweep_frenet +sweep_frenet = True +global sweep_transition +sweep_transition = 2 +global sweep_all +sweep_all = True +global BBox_volum +BBox_volum = False + m_numberLinePart = 2 m_numberLineCut = 2 m_numberPointCutWire = 2 @@ -224,7 +235,7 @@ def print_point(point, msg=""): #print_msg(str(point)) #m_type = point.__class__.__name__ #print_msg(str(m_type)) - print_msg(str(msg) + + print_msg(str(msg) + " " + "x =" + str(point.x) + ", " "y =" + str(point.y) + ", " "z =" + str(point.z)) @@ -266,7 +277,6 @@ def verbose_toggled(flag): def biColor_toggled(flag): """ Respond to the change of biColor flag. """ - global verbose msg=verbose global biColor biColor=0 @@ -279,7 +289,6 @@ def biColor_toggled(flag): def copy_toggled(flag): """ Respond to the change of Object copy flag. """ - global verbose msg=verbose global objCopy objCopy=0 @@ -425,6 +434,24 @@ def get_InfoObjects(info=0, printError=True): ", m_objNames=" + str(m_objNames)) return m_num, m_selEx, m_objs, m_objNames +def reset_SelectedObjects(Selection, info=0): + """ Reset the selection changed by Draft.rotate for example + Selection is the original selection you want to reset. Must be saved before any + change! + """ + Gui.Selection.clearSelection() + for Sel_i_Object in Selection: + m_DocumentName = Sel_i_Object.DocumentName + m_ObjectName = Sel_i_Object.ObjectName + m_Object = Sel_i_Object.Object + print_msg(str(m_Object)) + for m_SubElementName in Sel_i_Object.SubElementNames: + if info != 0: + m_finalName = str(m_DocumentName)+"."+str(m_ObjectName)+"."+str(m_SubElementName) + print_msg(m_finalName) + Gui.Selection.addSelection(m_Object,str(m_SubElementName)) + + def get_SelectedObjectsWithParent(info=0, printError=True): """ Return selected objects as Selection = (Number_of_Points, Number_of_Edges, Number_of_Planes, @@ -477,8 +504,71 @@ def get_SelectedObjectsWithParent(info=0, printError=True): printError_msg("No active document !") return - def get_SelectedObjects(info=0, printError=True): + """ Return selected objects as + Selection = (Number_of_Points, Number_of_Edges, Number_of_Planes, + Selected_Points, Selected_Edges, Selected_Planes) + """ + def storeShapeType(Object, Selected_Points, Selected_Edges, Selected_Planes): + if Object.ShapeType == "Vertex": + Selected_Points.append(Object) + if Object.ShapeType == "Edge": + Selected_Edges.append(Object) + if Object.ShapeType == "Face": + Selected_Planes.append(Object) + + m_actDoc=get_ActiveDocument(info=0) + + if m_actDoc.Name: + # Return a list of SelectionObjects for a given document name. + # "getSelectionEx" Used for selecting subobjects + m_selEx = Gui.Selection.getSelectionEx(m_actDoc.Name) + + m_num = len(m_selEx) + if info != 0: + print_msg("m_selEx : " + str(m_selEx)) + print_msg("m_num : " + str(m_num)) + + if m_num >= 1: + Selected_Points = [] + Selected_Edges = [] + Selected_Planes = [] + for Sel_i_Object in m_selEx: + if info != 0: + print_msg("Processing : " + str(Sel_i_Object.ObjectName)) + + if Sel_i_Object.HasSubObjects: + for Object in Sel_i_Object.SubObjects: + if info != 0: + print_msg("SubObject : " + str(Object)) + if hasattr(Object, 'ShapeType'): + storeShapeType(Object, Selected_Points, Selected_Edges, Selected_Planes) + else: + storeShapeType(Sel_i_Object.Object.Shape, Selected_Points, Selected_Edges, Selected_Planes) + + + + Number_of_Points = len(Selected_Points) + Number_of_Edges = len(Selected_Edges) + Number_of_Planes = len(Selected_Planes) + Selection = (Number_of_Points, Number_of_Edges, Number_of_Planes, + Selected_Points, Selected_Edges, Selected_Planes) + if info != 0: + print_msg("Number_of_Points, Number_of_Edges, Number_of_Planes," + + "Selected_Points, Selected_Edges, Selected_Planes = " + str(Selection)) + return Selection + else: + if info != 0: + print_msg("No Object selected !") + if printError: + printError_msg("Select at least one object !") + return None + else: + printError_msg("No active document !") + return + + +def get_SelectedObjects_old(info=0, printError=True): """ Return selected objects as Selection = (Number_of_Points, Number_of_Edges, Number_of_Planes, Selected_Points, Selected_Edges, Selected_Planes) @@ -530,6 +620,66 @@ def get_SelectedObjects(info=0, printError=True): printError_msg("No active document !") return + +def get_wireListFromObjectName(objName, subSelection=True, msg=1): + """ Return a list of wires from a selected object. + objName is the name of the selected object + subSelection is a flag to say if we want to select from the object: + Only the wire selected (True) or + All wires belonging to this object (False) + """ + if (None in [objName]) : + return None + m_wires = [] + m_name = objName + + if subSelection : + if msg != 0: + print "subSelection is True" + for o in Gui.Selection.getSelectionEx(): + if msg != 0: + print "ObjectName selected is : " + str(o.ObjectName) + if str(o.ObjectName) == str(m_name): + if msg != 0: + print "Found : " + str(m_name) + for s in o.SubObjects: + if msg != 0: + print "SubObjects : " + str(s) + if hasattr(s, 'Shape') : + if msg != 0: + print "s.Shape : " + str(s.Shape) + if isinstance(s.Shape,Part.Compound): + for wire in s.Shape.Wires: + m_wires.append(Part.Wire([wire])) + if isinstance(s.Shape,Part.Edge) or isinstance(s.Shape,Part.Wire): + m_wires.append(Part.Wire([s.Shape])) + if hasattr(s, 'ShapeType') : + if msg != 0: + print "s.ShapeType : " + str(s.ShapeType) + if s.ShapeType == 'Edge': + m_wires.append(Part.Wire([s])) + if s.ShapeType == 'Face': + for e in s.Edges: + m_wires.append(Part.Wire([e])) + else: + if msg != 0: + print "subSelection is False" + for o in Gui.Selection.getSelectionEx(): + if msg != 0: + print "ObjectName selected is : " + str(o.ObjectName) + if str(o.ObjectName) == str(m_name): + if msg != 0: + print "Found : " + str(m_name) + if isinstance(o.Object.Shape,Part.Compound): + for wire in o.Object.Shape.Wires: + m_wires.append(Part.Wire([wire])) + elif isinstance(o.Object.Shape,Part.Edge) or isinstance(o.Object.Shape,Part.Wire): + m_wires.append(Part.Wire([o.Object.Shape])) + else: + m_wires = get_wireListFromObjectName(m_name,True,msg=msg) + #m_wires.append(Part.Wire([o.Object.Shape])) + return m_wires + def getType(objs): if isinstance(objs,list): @@ -863,7 +1013,7 @@ def centerCirclePoint(edge,info=0): def distanceBetween(A, B): """ Return the distance between 2 points. """ - # if isinstance(A,FreeCAD.Vector) and isinstance(B,FreeCAD.Vector): + # if isinstance(A,App.Vector) and isinstance(B,App.Vector): line = Part.Line(A,B) edge = line.toShape() return edge.Length @@ -983,6 +1133,46 @@ def intersecPoints(shape1, shape2, info=0): return None return +def findNormal(wire, forceDiscretize=False, msg=1): + """Look for the Normal for wire. + """ + wire_points = [] + if forceDiscretize: + if hasattr(wire,'discretize') != True: + printError_msg("No discretize function for the wire!") + return None + wire_points = wire.discretize(4) + if len(wire_points) <= 2: + printError_msg("Unable to discretize the wire!") + return None + m_vect01 = wire_points[1] - wire_points[0] + m_vect02 = wire_points[2] - wire_points[0] + wire_normal = m_vect01.cross(m_vect02) + if msg != 0: + print_msg("Normal by discretize() !") + + else: + if len(wire.Edges) != 0: + wire_normal = wire.Edges[0].tangentAt(0) + wire_points.append(wire.Vertexes[0].Point) + if msg != 0: + print_msg("Normal by Tangent !") + else : + + if hasattr(wire,'discretize') != True: + printError_msg("No discretize function for the wire!") + return + wire_points = wire.discretize(Distance=0.01) + if len(wire_points) <= 2: + printError_msg("Unable to discretize the wire!") + return + wire_normal = wire_points[1] - wire_points[0] + if msg != 0: + print_msg("Normal by discretize() !") + + wire_normal.normalize() + return wire_normal, wire_points + def getClickedPoint(info): global verbose msg=verbose @@ -1010,11 +1200,14 @@ def getClickedPoint(info): def getClickedNormal(info): + import Mesh msg=0 view = Gui.ActiveDocument.ActiveView down = (info["State"] == "DOWN") pos = info["Position"] + if msg != 0: + #print_msg("info : " + str(info)) print_msg("info['Position'] : " + str(pos)) global m_stack global m_callback @@ -1026,28 +1219,66 @@ def getClickedNormal(info): if msg != 0: print_msg("view.getPoint(pos[0],pos[1] : " + str(point)) print_msg("view.getObjectInfo(pos) : " + str(obj)) + if obj == None: printError_msg("No Object selected !") view.removeEventCallback("SoMouseButtonEvent",m_callback) return None else: m_sel = Gui.Selection.getSelection()[0] - m_face = m_sel.Shape.Faces[0] - m_surf = m_face.Surface - m_p = App.Vector(obj["x"],obj["y"],obj["z"]) - m_uv = m_surf.parameter(m_p) - u,v = m_uv[0], m_uv[1] - m_p1 = m_face.valueAt(u,v) - m_p2 = m_face.normalAt(u,v) - if m_extensionFaceNormal == 0.0: - m_extensionFaceNormal = 10.0 - m_p3 = m_p1 + m_p2.normalize().multiply(m_extensionFaceNormal) - createFolders('WorkAxis') - name = "Normal" - plot_axis(m_p1,m_p3, part, name) - createFolders('WorkPoints') - name = "Point" - plot_point(m_p1, part, name) + if hasattr(m_sel, 'Shape'): + if len(m_sel.Shape.Faces) > 0: + # find the face selected + if msg != 0: + print_msg( str(obj["Component"])+ " selected !") + + if len(m_sel.Shape.Faces) == 1: + m_face = m_sel.Shape.Faces[0] + else: + m_face=eval('m_sel.Shape.'+str(obj["Component"])) + m_surf = m_face.Surface + m_p = App.Vector(obj["x"],obj["y"],obj["z"]) + m_uv = m_surf.parameter(m_p) + u,v = m_uv[0], m_uv[1] + m_p1 = m_face.valueAt(u,v) + m_p2 = m_face.normalAt(u,v) + if m_extensionFaceNormal == 0.0: + m_extensionFaceNormal = 10.0 + m_p3 = m_p1 + m_p2.normalize().multiply(m_extensionFaceNormal) + createFolders('WorkAxis') + name = "Normal" + plot_axis(m_p1,m_p3, part, name) + createFolders('WorkPoints') + name = "Point" + plot_point(m_p1, part, name) + else: + printError_msg("No Face selected !") + else: + if isinstance(m_sel,Mesh.Feature): + print_msg("Mesh selected !") + # find the facet selected + r = Gui.ActiveDocument.ActiveView.getCameraOrientation() + start = r.Axis + m_mesh = m_sel.Mesh + m_FacetsSel = m_mesh.nearestFacetOnRay((obj["x"],obj["y"],obj["z"]),(start.x,start.y,start.z)) + if len(m_FacetsSel) == 0: + return + m_p1 = App.Vector(obj["x"],obj["y"],obj["z"]) + for idx in m_FacetsSel.keys(): + m_p2 = App.Vector(m_mesh.Facets[idx].Normal) + + if m_extensionFaceNormal == 0.0: + m_extensionFaceNormal = 10.0 + m_p3 = m_p1 + m_p2.normalize().multiply(m_extensionFaceNormal) + createFolders('WorkAxis') + name = "Normal" + plot_axis(m_p1,m_p3, part, name) + createFolders('WorkPoints') + name = "Point" + plot_point(m_p1, part, name) + else: + printError_msg("No Shape available for : " + str(m_sel) + "\nat " + str(App.Vector(obj["x"],obj["y"],obj["z"]))) + view.removeEventCallback("SoMouseButtonEvent",m_callback) @@ -1535,7 +1766,7 @@ def plot_text(letter, size, part, name, grp="WorkObjects"): return text_User_Name, ss -def plot_point(Vector_point, part, name, grp="WorkPoints"): +def plot_point(Vector_point, part="Part::Feature", name="Point", grp="WorkPoints"): if not(App.ActiveDocument.getObject( grp )): App.ActiveDocument.addObject("App::DocumentObjectGroup", grp) point = App.ActiveDocument.addObject( part, name ) @@ -1546,7 +1777,7 @@ def plot_point(Vector_point, part, name, grp="WorkPoints"): return point_User_Name -def plot_axis(Vector_A, Vector_B, part, name, grp="WorkAxis"): +def plot_axis(Vector_A, Vector_B, part="Part::Feature", name="Axis", grp="WorkAxis"): if not(App.ActiveDocument.getObject( grp )): App.ActiveDocument.addObject("App::DocumentObjectGroup", grp) axis = App.ActiveDocument.addObject(part, name) @@ -1771,8 +2002,30 @@ def plot_Dome(Point, Radius, Frequency, part="Part::Feature", name="Dome", grp=" Gui.ActiveDocument.getObject( dome_User_Name ).Transparency = 75 return dome_User_Name, dome + +def plot_sweep(traj, section, makeSolid=True, isFrenet=True, transition=2 , part="Part::Feature", name="Sweep", grp="WorkObjects"): + if not(App.ActiveDocument.getObject( grp )): + App.ActiveDocument.addObject("App::DocumentObjectGroup", grp) + sweep = App.ActiveDocument.addObject(part, name) + # create a 3D shape and assigh it to the current document +#============================================================================== +# makePipeShell(shapeList,[isSolid,isFrenet,transition]) +# Make a loft defined by a list of profiles along a wire. Transition can be +# 0 (default), 1 (right corners) or 2 (rounded corners). +#============================================================================== + Sweep = Part.Wire(traj).makePipeShell([section],makeSolid,isFrenet,transition) -def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): + sweep.Shape = Sweep + App.ActiveDocument.getObject( grp ).addObject( sweep ) + obj_User_Name = sweep.Label + Gui.ActiveDocument.getObject( obj_User_Name ).PointColor = (1.00,0.67,0.00) + Gui.ActiveDocument.getObject( obj_User_Name ).LineColor = (1.00,0.67,0.00) + Gui.ActiveDocument.getObject( obj_User_Name ).ShapeColor = (0.00,0.33,1.00) + Gui.ActiveDocument.getObject( obj_User_Name ).Transparency = 75 + return obj_User_Name, sweep + + +def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,createVol=False,info=0): """ Create a bounding box. """ m_grp = grp @@ -1784,6 +2037,7 @@ def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): m_o_Z = ori_Z global flag_for_face flag_for_face = True + flag_for_volume = createVol if info != 0: print_msg("Xmin, Ymin, Zmin : \n" + @@ -1798,7 +2052,9 @@ def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): m_rect = Draft.makeRectangle(length=m_l_X,height=m_l_Y, placement=m_pl_0,face=flag_for_face,support=None) addObjectToGrp(m_rect,m_grp,info=info) - definePropOfActiveObj() + definePropOfActiveObj() + if flag_for_volume: + Gui.ActiveDocument.getObject(m_rect.Label).Visibility=False except: printError_msg("Rectangle 0 not done !") try: @@ -1807,7 +2063,9 @@ def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): m_rect = Draft.makeRectangle(length=m_l_X,height=m_l_Y, placement=m_pl_1,face=flag_for_face,support=None) addObjectToGrp(m_rect,m_grp,info=info) - definePropOfActiveObj() + definePropOfActiveObj() + if flag_for_volume: + Gui.ActiveDocument.getObject(m_rect.Label).Visibility=False except: printError_msg("Rectangle 1 not done !") @@ -1818,7 +2076,9 @@ def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): m_rect = Draft.makeRectangle(length=m_l_X,height=m_l_Z, placement=m_pl_2,face=flag_for_face,support=None) addObjectToGrp(m_rect,m_grp,info=info) - definePropOfActiveObj() + definePropOfActiveObj() + if flag_for_volume: + Gui.ActiveDocument.getObject(m_rect.Label).Visibility=False except: printError_msg("Rectangle 2 not done !") try: @@ -1827,7 +2087,9 @@ def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): m_rect = Draft.makeRectangle(length=m_l_X,height=m_l_Z, placement=m_pl_3,face=flag_for_face,support=None) addObjectToGrp(m_rect,m_grp,info=info) - definePropOfActiveObj() + definePropOfActiveObj() + if flag_for_volume: + Gui.ActiveDocument.getObject(m_rect.Label).Visibility=False except: printError_msg("Rectangle 3 not done !") @@ -1838,7 +2100,9 @@ def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): m_rect = Draft.makeRectangle(length=m_l_Y,height=m_l_Z, placement=m_pl_4,face=flag_for_face,support=None) addObjectToGrp(m_rect,m_grp,info=info) - definePropOfActiveObj() + definePropOfActiveObj() + if flag_for_volume: + Gui.ActiveDocument.getObject(m_rect.Label).Visibility=False except: printError_msg("Rectangle 4 not done !") try: @@ -1847,10 +2111,17 @@ def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): m_rect = Draft.makeRectangle(length=m_l_Y,height=m_l_Z, placement=m_pl_5,face=flag_for_face,support=None) addObjectToGrp(m_rect,m_grp,info=info) - definePropOfActiveObj() + definePropOfActiveObj() + if flag_for_volume: + Gui.ActiveDocument.getObject(m_rect.Label).Visibility=False except: printError_msg("Rectangle 5 not done !") - + + if not flag_for_volume: + print_msg("Bounding Box Planes created !") + return + + # Else Create Volume #if (m_l_X != 0.0) and (m_l_Y != 0.0) and (m_l_Z != 0.0): try: if (m_l_X == 0.0): @@ -1865,16 +2136,17 @@ def bounding_box(grp,ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info=0): m_pnt = App.Vector(m_o_X ,m_o_Y,m_o_Z) print_point(m_pnt, msg="m_pnt") # adds object to the document group - box = App.ActiveDocument.addObject("Part::Feature", "BBox") + box = App.ActiveDocument.addObject("Part::Feature", "BBoxVolume") #By default pnt=Vector(0,0,0) and dir=Vector(0,0,1) Box_face = Part.makeBox(m_l_X,m_l_Y,m_l_Z,m_pnt) #print_msg("Box_face :" + str(Box_face) ) box.Shape = Box_face m_grp.addObject( box ) Gui.activeDocument().activeObject().Transparency = (50) - print_msg("Bounding Box created !") + print_msg("Bounding Box Volume created !") except: - printError_msg("Bounding Box not created !") + printError_msg("Bounding Box Volume not created !") + #============================================================================== @@ -2955,21 +3227,21 @@ def plot_baseObjectPoint(): printError_msg(error_msg) - - def point_toSketch(): """ Transform Point(s) in Sketch's Point(s) by projection onto the Sketch's Plane: - First select an existing Sketch; - Select as much as Points needed; Then click on this button. """ - global verbose msg=verbose + msg=1 m_actDoc = get_ActiveDocument(info=msg) if m_actDoc == None: return None - error_msg = "Transform Point(s) in Sketch's Point(s) : \nFirst select an existing Skecth\nthen select point(s) !" + error_msg = "Transform Point(s) in Sketch's Point(s) : \n" +\ + "First select an existing Sketch\n" +\ + "then select point(s) !" result_msg = " : Point(s) transformed in Sketch's Point(s) done!" m_sel = Gui.Selection.getSelection(m_actDoc.Name) @@ -3000,14 +3272,18 @@ def point_toSketch(): m_rec = Part.makePlane(1,1) m_rec.Placement = m_sketch.Placement m_recN = m_rec.normalAt(0,0) + # Build a geometry list geoList = [] # Get Point(s) from the selection - for m_i in range(1,m_num): - m_obj = m_selEx[m_i] + #for m_i in range(1,m_num): + for m_obj in m_selEx[1:]: + #m_obj = m_selEx[m_i] if len(m_obj.SubObjects) != 0: SubObject = m_obj.SubObjects[0] if SubObject.ShapeType == "Vertex": + #placement = App.Placement() + #m_sketch.Placement = placement if msg != 0: print_msg("Found a Points object!") Point = m_obj.SubObjects[0] @@ -3015,11 +3291,14 @@ def point_toSketch(): m_p = Point.Point # Projection of the Point selected onto the Sketch Plane Projection = m_p.projectToPlane(m_sketch.Placement.Base, m_recN) + plot_axis(m_p, m_p.add(m_recN), part="Part::Feature", name="Norml", grp="WorkAxis") + plot_point(Projection, part="Part::Feature", name="Proj", grp="WorkPoints") # Append the Projection geoList.append(Part.Point(Projection)) # Add the geometry list to the Sketch m_sketch.addGeometry(geoList) - m_num_point = m_num_point + 1 + m_num_point = m_num_point + 1 + #m_sketch.Placement = m_rec.Placement else: continue else: @@ -3374,9 +3653,113 @@ def extensionFaceNormal(value): print_msg("New extension is :" + str(m_extensionFaceNormal)) except ValueError: printError_msg("Extension must be valid number !") - + def plot_faceNormal(): + """Create a normal Axis at click location of a Face or at a selected point location. + """ + msg=verbose + global m_callback + + createFolders('WorkAxis') + error_msg = "Unable to create Normal Axis : \n" + \ + "To create a Normal at click location on a Face:\n" + \ + "- Click first in the view to select and object,\n" + \ + "- then push the button,\n" + \ + "- then click on a location on the selected Face.\n" + \ + "or\n" + \ + "To create several Normal of the face:\n" + \ + "- Click first in the view to select and object,\n" + \ + "- then select one or several points of the face\n" + \ + "- then push the button.\n" + \ + "(These selections can also be done into the Combined View)" + result_msg = "Normal Axis created !" + + def plot_normal(m_sel, m_point): + import Mesh + global m_extensionFaceNormal + part = "Part::Feature" + if hasattr(m_sel, 'Shape'): + if len(m_sel.Shape.Faces) > 0: + m_face = m_sel.Shape.Faces[0] + m_surf = m_face.Surface + m_p = m_point + m_uv = m_surf.parameter(m_p) + u,v = m_uv[0], m_uv[1] + m_p1 = m_face.valueAt(u,v) + m_p2 = m_face.normalAt(u,v) + if m_extensionFaceNormal == 0.0: + m_extensionFaceNormal = 10.0 + m_p3 = m_p1 + m_p2.normalize().multiply(m_extensionFaceNormal) + createFolders('WorkAxis') + name = "Normal" + plot_axis(m_p1,m_p3, part, name) + createFolders('WorkPoints') + name = "Point" + plot_point(m_p1, part, name) + return True + else: + printError_msg("No Face selected !") + return False + else: + if isinstance(m_sel,Mesh.Feature): + print_msg("Mesh selected !") + # find the facet selected + r = Gui.ActiveDocument.ActiveView.getCameraOrientation() + start = r.Axis + m_mesh = m_sel.Mesh + m_FacetsSel = m_mesh.nearestFacetOnRay((m_point.x,m_point.y,m_point.z),(start.x,start.y,start.z)) + if len(m_FacetsSel) == 0: + return + m_p1 = m_point + for idx in m_FacetsSel.keys(): + m_p2 = App.Vector(m_mesh.Facets[idx].Normal) + + if m_extensionFaceNormal == 0.0: + m_extensionFaceNormal = 10.0 + m_p3 = m_p1 + m_p2.normalize().multiply(m_extensionFaceNormal) + createFolders('WorkAxis') + name = "Normal" + plot_axis(m_p1,m_p3, part, name) + createFolders('WorkPoints') + name = "Point" + plot_point(m_p1, part, name) + return True + else: + printError_msg("No Shape available for : " + str(m_sel) + "\nat " + str(m_point)) + return False + + if len(Gui.Selection.getSelectionEx()) >= 2: + SelectedObjects = get_SelectedObjects(info=msg, printError=False) + + Number_of_Points = SelectedObjects[0] + Number_of_Planes = SelectedObjects[2] + if msg != 0: + print_msg(" Number_of_Planes=" + str(Number_of_Planes)) + print_msg(" Number_of_Points=" + str(Number_of_Points)) + Point_List = SelectedObjects[3] + Plane_List = SelectedObjects[5] + if msg != 0: + print_msg(" Point_List=" + str(Point_List)) + print_msg(" Plane_List=" + str(Plane_List)) + + if Number_of_Planes == 1 and Number_of_Points >=1 : + m_sel = Plane_List[0] + m_sel = Gui.Selection.getSelection()[0] + for Selected_Point in Point_List: + m_point = Selected_Point.Point + if not plot_normal(m_sel, m_point): + break + else: + print_msg( result_msg ) + else: + printError_msg(error_msg) + else: + view = Gui.ActiveDocument.ActiveView + m_callback = view.addEventCallback("SoMouseButtonEvent",getClickedNormal) + + +def plot_faceNormal_old(): """Create a normal Axis at click location of a Face. """ global m_callback @@ -5751,7 +6134,7 @@ def plot_clickForPlane2(): if msg !=0: print_msg("Create plane ("+str(m_radius)+" mm)") - pl = FreeCAD.Placement() + pl = App.Placement() pl.Rotation = Gui.ActiveDocument.ActiveView.getCameraOrientation() @@ -5767,16 +6150,16 @@ def plot_clickForPlane2(): yP = float(datExtract(plan)[1]) zP = float(datExtract(plan)[2]) qP = float(datExtract(plan)[3]) - pl = FreeCAD.Placement() + pl = App.Placement() pl.Rotation.Q = (xP,yP,zP,qP) # rotation of object - pl.Base = FreeCAD.Vector(positionX,positionY,positionZ) # here coordinates XYZ of plan - points=[FreeCAD.Vector(-(radiusP*1.5),0,0),FreeCAD.Vector((radiusP*1.5),0,0)] + pl.Base = App.Vector(positionX,positionY,positionZ) # here coordinates XYZ of plan + points=[App.Vector(-(radiusP*1.5),0,0),App.Vector((radiusP*1.5),0,0)] mire01 = Draft.makeWire(points,closed=False,placement=pl,face=False,support=None) FreeCADGui.ActiveDocument.getObject(App.ActiveDocument.ActiveObject.Name).LineColor = (1.0,0.0,0.0) FcPlane.addObject(mire01) # contener character - points=[FreeCAD.Vector(0,-(radiusP*1.5),0),FreeCAD.Vector(0,(radiusP*1.5),0)] + points=[App.Vector(0,-(radiusP*1.5),0),App.Vector(0,(radiusP*1.5),0)] mire02 = Draft.makeWire(points,closed=False,placement=pl,face=False,support=None) FreeCADGui.ActiveDocument.getObject(App.ActiveDocument.ActiveObject.Name).LineColor = (1.0,0.0,0.0) FcPlane.addObject(mire02) # contener character @@ -5785,7 +6168,7 @@ def plot_clickForPlane2(): Rnameplane = App.ActiveDocument.ActiveObject.Name App.ActiveDocument.ActiveObject.Label = "PlaneC" - FreeCAD.ActiveDocument.getObject(Rnameplane).MakeFace = True + App.ActiveDocument.getObject(Rnameplane).MakeFace = True FreeCADGui.ActiveDocument.getObject(Rnameplane).LineColor = (1.0,0.0,0.0) FreeCADGui.ActiveDocument.getObject(Rnameplane).ShapeColor = (0.0,0.66666669,1.0) FreeCADGui.ActiveDocument.getObject(Rnameplane).Transparency = 80 @@ -5794,7 +6177,7 @@ def plot_clickForPlane2(): FreeCADGui.ActiveDocument.getObject(Rnameplane).ShowGrid = True FcPlane.addObject(cercle) # contener character - FreeCAD.ActiveDocument.recompute() + App.ActiveDocument.recompute() positionX = 0.0 positionY = 0.0 @@ -5986,11 +6369,19 @@ def get_all_from_bounding_box(ori_X,ori_Y,ori_Z,length_X,length_Y,length_Z,info= return Points, Edges, Faces +def volumBBox_toggled(flag): + """ Respond to the change of solid flag. + """ + global BBox_volum + BBox_volum = flag + def plot_boundingBoxes(): """Create bounding boxes around each of selected object(s). """ - msg=0 + msg=verbose + createVol=BBox_volum + createFolders('WorkBoxes') error_msg = "Select at least one object !" result_msg = "Bounding box created !" @@ -6037,7 +6428,7 @@ def plot_boundingBoxes(): m_ori_Y = m_boundBox.YMin m_ori_Z = m_boundBox.ZMin - bounding_box(m_grp,m_ori_X,m_ori_Y,m_ori_Z,m_length_X,m_length_Y,m_length_Z,info=msg) + bounding_box(m_grp,m_ori_X,m_ori_Y,m_ori_Z,m_length_X,m_length_Y,m_length_Z,createVol,info=msg) m_actDoc.recompute() m_i = m_i +1 @@ -6050,7 +6441,9 @@ def plot_boundingBoxes(): def plot_boundingBox(): """ Create one bounding box around all of selected object(s). """ - msg=0 + msg=verbose + createVol=BBox_volum + createFolders('WorkBoxes') error_msg = "Select at least one object !" result_msg = "Bounding box created !" @@ -6078,7 +6471,7 @@ def plot_boundingBox(): m_ori_X = m_xmin m_ori_Y = m_ymin m_ori_Z = m_zmin - bounding_box(m_grp,m_ori_X,m_ori_Y,m_ori_Z,m_length_X,m_length_Y,m_length_Z,info=msg) + bounding_box(m_grp,m_ori_X,m_ori_Y,m_ori_Z,m_length_X,m_length_Y,m_length_Z,createVol,info=msg) m_actDoc.recompute() print_msg(result_msg) @@ -6126,8 +6519,8 @@ def plot_axisPointCylinder(): result_msg = " : Cylinder(s) created !" name = "Cylinder" part = "Part::Feature" - global m_diameterCylinder - global m_lengthCylinder + #global m_diameterCylinder + #global m_lengthCylinder m_actDoc = get_ActiveDocument(info=msg) if m_actDoc.Name == None: @@ -6214,9 +6607,9 @@ def plot_axisPointCube(): result_msg = " : Cube(s) created !" name = "Cuboid" part = "Part::Feature" - global m_lengthCube - global m_widthCube - global m_heightCube + #global m_lengthCube + #global m_widthCube + #global m_heightCube m_actDoc = get_ActiveDocument(info=msg) if m_actDoc.Name == None: @@ -6866,8 +7259,16 @@ def angleRevolve(value): def plot_revolution(): """ Revolve: - Make the revolution of an Object around an Axis: - - Select on or several axis(es) and one or several wire(s) + Make the revolution of Edge(s) or Wire(s) around an Axis: + - Select one or several wire(s) + or + - Select FIRST one Point as center of rotation and one Axis as rotation axis ! + - Select one or several wire(s) + + NB: + You can also define the angle of revolution if needed + If no Axis is selected the Z axis is considered as Axis of rotation ! + If no Point is selected the Origin is considered as Center of rotation ! """ @@ -6978,6 +7379,419 @@ def plot_revolution(): except: printError_msg(error_msg) + + +def frenet_toggled(flag): + """ Respond to the change of frenet flag. + """ + global sweep_frenet + sweep_frenet = flag + + +def solid_toggled(flag): + """ Respond to the change of solid flag. + """ + global sweep_solid + sweep_solid = flag + + +def subselect_toggled(flag): + """ Respond to the change of allsubselect flag. + """ + global sweep_all + sweep_all = flag + + +def transition(*argc): + """ Transition between profiles choice by combo box. + Options : + No Transition (or 0) (default) + Right corners (or 1) + Rounded corners (or 2) + """ + global sweep_transition + msg=verbose + if msg != 0: + print_msg("Transition between profiles choice by combo box !") + sweep_transition = 2 + if str(*argc) == "No Transition": + sweep_transition = 0 + if str(*argc) == "Right corners": + sweep_transition = 1 + if str(*argc) == "Rounded corners": + sweep_transition = 2 + + +def plot_sectionSweep(): + """ Section Sweep: + # Make a loft defined by a list of profiles along a wire. + Will extrude/sweep a Section along a Trajectory like sweep from Part Workbench but: + - the Section center (of Mass) is move at the first point of the Trajectory and; + - the "plane" of the Section is rotate to be perpendicular to the Trajectory. + + - Select first one Section wire (Closed wire will generate volumes by default) + (This Section can be a compound from sketch to realize "tube") + - Select one or several wire(s) as Trajectory(ies) + - Then push this button + + NB: You can change first: + - Solid option (if toggled will generate a solid for Closed wire Section only) + - isFrenet option + - All option (means if the trajectory selected is a compound, all sub wires will be used for the sweep) + - Transition Option (Select a Transition option in case of trajectory with several wires; Transition can be: + # 0 (default), 1 (right corners) or 2 (rounded corners).) + """ + msg=verbose + + # Variable makeSolid = 1 to create solid if section is closed, 0 to create surfaces + makeSolid=sweep_solid + isFrenet=sweep_frenet + # Transition between profiles can be 0 (default), 1 (right corners) + # or 2 (rounded corners) + transition=sweep_transition + # If several sub profiles when this flag is true only the sub profile selected + # will be processed + allSubProfile=sweep_all + +# if msg != 0: +# print_msg("makeSolid = " + str(makeSolid)) +# print_msg("isFrenet = " + str(isFrenet)) +# print_msg("transition = " + str(transition)) +# print_msg("allSubProfile = " + str(allSubProfile)) + + createFolders('WorkAxis') + createFolders('WorkPoints') + createFolders('WorkObjects') + error_msg =\ + "INCORRECT Object(s) Selection :\n" +\ + "First select the wire you want as section for Section Sweep (must be closed for solid creation!)\n" +\ + "Then select the second wire for the trajectory of the Sweep !" + result_msg = " : Section Sweep created !" + name = "SectionSweep" + part = "Part::Feature" + + m_actDoc=App.activeDocument() + if m_actDoc.Name: + m_sel = Gui.Selection.getSelection(m_actDoc.Name) + m_selEx = Gui.Selection.getSelectionEx(m_actDoc.Name) + else: + return + +# if msg != 0: +# print_msg("m_sel = " + str(m_sel)) +# m_num_objs = len(m_sel) +# print_msg("m_num_objs = " + str(m_num_objs)) + + try: + SelectedObjects = m_sel + + # First object selected is the section then other are trajectories + if not (hasattr(SelectedObjects[0], 'Shape') and hasattr(SelectedObjects[1], 'Shape')) : + printError_msg("Object without Shape selected \n"+ str(error_msg)) + return + if msg != 0: + print_msg("01-First object selected is the section then other are trajectories") + print_msg("Object with Shape selected = " + str(SelectedObjects)) + + # Make a copy of the section + m_copy = App.activeDocument().copyObject(SelectedObjects[0]) + shape0 = m_copy.Shape + if msg != 0: + print_msg("02-Make a copy of the section") + print_msg("shape0 = " + str(shape0)) + + # Get the list of sections in case of first section is a Compound + m_sections = [] + if isinstance(shape0,Part.Compound): + m_msg = "Compound Section Found !" + for wire in shape0.Wires: + m_sections.append(Part.Wire([wire])) + else: + m_msg = "NO Compound Found !" + m_sections.append(Part.Wire([shape0])) + + if msg != 0: + print_msg("03-Get the list of sections in case of first section is a Compound") + print_msg(m_msg) + print_msg("m_sections = " + str(m_sections)) + + # Loop on sections + for m_id in range(len(m_sections)): + m_section = m_sections[m_id] + if msg != 0: + print_msg("04-Loop on sections") + print_msg("Section Selected = " + str(m_section)) + + # Loop on trajectories + for selObj in SelectedObjects[1:]: + if not hasattr(selObj, 'Shape') : + continue +# if msg != 0: +# print_msg("Processing selObj.Name = " + str(selObj.Name)) + m_traj_points = [] + m_section_points = [] + rot_center = m_section.CenterOfMass + + # Look for the Normal of section wire + m_section_normal, m_section_points = findNormal(m_section, forceDiscretize=True, msg=msg) + +# if msg != 0: +# print_point(m_section_normal, msg="NormalOfSection = ") +# axis_User_Name, axis = plot_axis(rot_center, rot_center.add(m_section_normal), part="Part::Feature", name="NormalOfSection", grp="WorkAxis") +# Gui.ActiveDocument.getObject(axis_User_Name).LineColor = (1.0,0.0,0.0) + + # List of trajectories + m_trajs = [] + m_trajs = get_wireListFromObjectName(selObj.Name,subSelection=not(allSubProfile),msg=msg) + if msg != 0: + print_msg("m_trajs = " + str(m_trajs)) + for s in m_trajs: + shape2 = s + m_traj = Part.Wire([shape2]) + if msg != 0: + print_msg("m_section = " + str(m_section)) + print_msg("m_traj = " + str(m_traj)) + + # Look for the Normal for trajectory wire + m_traj_normal, m_traj_points = findNormal(m_traj, forceDiscretize=False, msg=msg) + +# if msg != 0: +# print_point(m_traj_normal, msg="NormalOfTrajectory = ") +# axis_User_Name, axis = plot_axis(rot_center, rot_center.add(m_traj_normal), part, name="NormalOfTrajectory", grp="WorkAxis") +# Gui.ActiveDocument.getObject(axis_User_Name).LineColor = (0.0,1.0,0.0) +# point_User_Name = plot_point(m_traj_points[0], part, name="End", grp="WorkPoints") +# Gui.ActiveDocument.getObject(point_User_Name).PointColor = (1.0,1.0,1.0) + + m_angle, m_angle_rad = angleBetween(m_traj_normal,m_section_normal) + rot_axis = m_traj_normal.cross(m_section_normal) + rot_angle = -1 * m_angle +# if msg != 0: +# print_msg("rot_angle = " + str(rot_angle)) +# axis_User_Name, axis = plot_axis(rot_center,rot_center.add( rot_axis), part, name="Normal", grp="WorkAxis") +# Gui.ActiveDocument.getObject(axis_User_Name).LineColor = (0.0,0.0,1.0) +# point_User_Name = plot_point(rot_center, part, name="Start", grp="WorkPoints") +# Gui.ActiveDocument.getObject( point_User_Name ).PointColor = (0.0,0.0,1.0) + + Draft.rotate(m_copy,rot_angle,rot_center,rot_axis,copy=False) +# if msg != 0: +# print_msg("rotation done !") + + # Reset the selection changed by Draft.rotate + reset_SelectedObjects(m_selEx, info=0) + + m_move = m_traj_points[0].sub(rot_center) + m_oldplace = m_copy.Placement + m_rot = m_copy.Placement.Rotation + m_base = m_copy.Placement.Base + if msg != 0: + print_msg("m_copy.Placement = " + str(m_copy.Placement)) + + m_newplace = App.Placement(m_base.add(m_move), m_rot ) + m_copy.Placement = m_newplace +# if msg != 0: +# print_msg("move done !") + + shape3 = m_copy.Shape + m_sections3 = [] + if isinstance(shape3,Part.Compound): + for wire in shape3.Wires: + m_sections3.append(Part.Wire([wire])) + else: + m_sections3.append(Part.Wire([shape3])) +# if msg != 0: +# print_msg("m_sections3 = " + str(m_sections3)) + + for m_id3 in range(len(m_sections3)): + m_section3 = m_sections3[m_id3] + if m_id == m_id3 : + Sweep_User_Name, sweep = plot_sweep(m_traj, m_section3, makeSolid, isFrenet, transition, part, name) + print_msg(str(Sweep_User_Name) + result_msg ) + + m_copy.Placement = m_oldplace + rot_angle = -1*rot_angle + Draft.rotate(m_copy,rot_angle,rot_center,rot_axis,copy=False) + reset_SelectedObjects(m_selEx, info=0) + + # Remove duplicated section + App.getDocument(str(App.activeDocument().Name)).removeObject(m_copy.Label) + + + except: + printError_msg(error_msg) + +def plot_sectionSweep2(): + """ + Beam Sweep: + Will sweep a Section along a Trajectory like sweep from Part worbench but: + - the Section center(of Mass) is move at the first point of the Trajectory and; + - the"plane" of the Section is rotate to be perpendicular to the Trajectory. + + - Select first one Section wire (Closed wire will generate volumes by default) + - Select one or several wire as Trajectory(ies) + + if Solid check box is toggled: + The Beam sweep will generate a solid with a closed selected wire as Section. + If this check box is toggle off: + Or if the Section wire is not closed, only a shell will be created. + """ + msg=verbose + msg=1 + + # variable makeSolid = 1 to create solid, 0 to create surfaces + makeSolid=ssweep_solid + isFrenet=sweep_frenet + transition=sweep_transition + + createFolders('WorkAxis') + createFolders('WorkPoints') + createFolders('WorkObjects') + error_msg =\ + "INCORRECT Object(s) Selection :\n" +\ + "First select the wire you want as section for Beam Sweep (must be closed)\n" +\ + "Then select the second wire for the trajectory of the Sweep !" + result_msg = " : Beam Sweep created !" + name = "BeamSweep" + part = "Part::Feature" + + m_actDoc=App.activeDocument() + if m_actDoc.Name: + m_sel = Gui.Selection.getSelection(m_actDoc.Name) + m_num_objs = len(m_sel) + if msg != 0: + print_msg("m_sel=" + str(m_sel)) + print_msg("m_num_objs=" + str(m_num_objs)) + + Origin = Base.Vector(0, 0, 0) + try: + SelectedObjects = m_sel + + if hasattr(SelectedObjects[0], 'Shape') and hasattr(SelectedObjects[1], 'Shape') : + if msg != 0: + print_msg("Both Object selected have a Shape") + + m_traj_points = [] + m_section_points = [] + shape0 = SelectedObjects[0].Shape + + # Look for Compound object like Sketch with several wires + if isinstance(shape0,Part.Compound): + m_face = Part.Face(shape0.Wires) + if msg != 0: + print_msg("Face Created!" + str(m_face)) + face = App.ActiveDocument.addObject("Part::Feature", 'Face') + face.Shape = m_face + rot_center = m_face.CenterOfMass + m_section_normal = m_face.normalAt(0,0) + else: + m_section = Part.Wire([shape0]) + if msg != 0: + print_msg("Section Created!" + str(m_section)) + rot_center = m_section.CenterOfMass + # Look for the Normal a Start of section wire + if hasattr(m_section,'discretize') != True: + printError_msg("Unable to discretize the section!") + return + m_section_points = m_section.discretize(4) + if len(m_section_points) <= 2: + printError_msg("Unable to discretize the section!") + return + m_vect01 = m_section_points[1] - m_section_points[0] + m_vect02 = m_section_points[2] - m_section_points[0] + m_section_normal = m_vect01.cross(m_vect02) + if msg != 0: + print_msg("Normal by discretize() !") + + m_section_normal.normalize() + if msg != 0: + print_point(m_section_normal, msg="NormalOfSection is ") + axis_User_Name, axis = plot_axis(Origin, m_section_normal, part, name="NormalOfSection", grp="WorkAxis") + Gui.ActiveDocument.getObject(axis_User_Name).LineColor = (1.0,0.0,0.0) + + + for selObj in SelectedObjects[1:]: + if not hasattr(selObj, 'Shape') : + continue + if isinstance(shape0,Part.Compound): + obj = App.ActiveDocument.addObject("Part::Feature", "Face") + m_obj.Shape = m_face + shape1 = m_obj.Shape + else: + m_obj = App.activeDocument().copyObject(SelectedObjects[0],True) + shape1 = m_obj.Shape + print_msg("shape 1 selected !" + str(shape1)) + + shape2 = selObj.Shape + print_msg("shape 2 selected !" + str(shape2)) + #shape2 = SelectedObjects[1].Shape + if isinstance(shape2,Part.Compound): + m_traj = Part.Wire([shape2.Wires[0]]) + if msg != 0: + print_msg("m_section !" + str(m_section)) + print_msg("m_traj !" + str(m_traj)) + else: + m_traj = Part.Wire([shape2]) + if msg != 0: + print_msg("m_section !" + str(m_section)) + print_msg("m_traj !" + str(m_traj)) + +#============================================================================== +# Look for the Normal a Start of trajectory wire +#============================================================================== + if len(shape2.Edges) != 0: + m_traj_normal = shape2.Edges[0].tangentAt(0) + m_traj_points.append(shape2.Vertexes[0].Point) + if msg != 0: + print_msg("Normal by Tangent !") + else : + if hasattr(m_traj,'discretize') != True: + printError_msg("Unable to discretize the trajectory!") + return + m_traj_points = m_traj.discretize(Distance=0.01) + if len(m_traj_points) <= 2: + printError_msg("Unable to discretize the trajectory!") + return + m_traj_normal = m_traj_points[1] - m_traj_points[0] + if msg != 0: + print_msg("Normal by discretize() !") + + m_traj_normal.normalize() + if msg != 0: + print_point(m_traj_normal, msg="NormalOfTrajectory is ") + axis_User_Name, axis = plot_axis(Origin, m_traj_normal, part, name="NormalOfTrajectory", grp="WorkAxis") + Gui.ActiveDocument.getObject(axis_User_Name).LineColor = (0.0,1.0,0.0) + point_User_Name = plot_point(m_traj_points[0], part, name="End", grp="WorkPoints") + Gui.ActiveDocument.getObject( point_User_Name ).PointColor = (1.0,1.0,1.0) + + m_angle, m_angle_rad = angleBetween(m_traj_normal,m_section_normal) + rot_axis = m_traj_normal.cross(m_section_normal) + rot_angle = -1 * m_angle + #rot_center = m_section.CenterOfMass + if msg != 0: + print_msg("rot_angle" + str(rot_angle)) + axis_User_Name, axis = plot_axis(Origin, rot_axis, part, name="Normal", grp="WorkAxis") + Gui.ActiveDocument.getObject(axis_User_Name).LineColor = (0.0,0.0,1.0) + point_User_Name = plot_point(rot_center, part, name="Start", grp="WorkPoints") + Gui.ActiveDocument.getObject( point_User_Name ).PointColor = (0.0,0.0,1.0) + + Draft.rotate(m_obj,rot_angle,rot_center,rot_axis) + m_move = m_traj_points[0].sub(rot_center) + #m_move = rot_center.add(m_move) + m_rot = m_obj.Placement.Rotation + m_base = m_obj.Placement.Base + if msg != 0: + print_msg("m_obj.Placement" + str(m_obj.Placement)) + + m_newplace = App.Placement(m_base.add(m_move), m_rot ) + m_obj.Placement = m_newplace + shape3 = m_obj.Shape + m_section2 = Part.Wire([shape3]) + Sweep_User_Name, sweep = plot_sweep(m_traj, m_section2, makeSolid, isFrenet, transition, part, name) + print_msg(str(Sweep_User_Name) + result_msg ) + if msg == 0: + App.getDocument(str(App.activeDocument().Name)).removeObject(m_obj.Label) + except: + printError_msg(error_msg) + def view_align(): """ Set the current view perpendicular to the selected Face, Edge @@ -8281,7 +9095,7 @@ def camera_orientation(): by the function getCameraOrientation(). """ msg=verbose - pl = FreeCAD.Placement() + pl = App.Placement() pl.Rotation = Gui.ActiveDocument.ActiveView.getCameraOrientation() xP = pl.Rotation.Q[0] @@ -8315,6 +9129,8 @@ def object_align2view(): if the Face of the object selected is already aligned to the view Plane, a rotation of 180 deg is applied to the object. In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + + Two clicks will rotate by 180 deg. """ msg=verbose @@ -8324,6 +9140,9 @@ def object_align2view(): "All Face(s) will be aligned to the actual view Plane!" Selection = get_SelectedObjectsWithParent(info=msg, printError=False) + m_actDoc=get_ActiveDocument(info=1) + Selection2 = Gui.Selection.getSelectionEx(m_actDoc.Name) + try: SelectedObjects = Selection Number_of_Planes = SelectedObjects[2] @@ -8367,6 +9186,8 @@ def object_align2view(): rot_center = Plane_Point rot_angle = m_angle Draft.rotate(Parent_Plane,rot_angle,rot_center,rot_axis) + # Reset the selection changed by Draft.rotate + reset_SelectedObjects(Selection2, info=0) else: printError_msg(error_msg) except: @@ -8399,7 +9220,9 @@ def object_alignFaces(): if the Face of the object selected is already aligned to the last one, a rotation of 180 deg is applied to the object. - In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + + Two clicks will rotate by 180 deg. """ msg=verbose @@ -8409,6 +9232,8 @@ def object_alignFaces(): "All Faces will be aligned to the last one !" Selection = get_SelectedObjectsWithParent(info=msg, printError=False) + m_actDoc=get_ActiveDocument(info=1) + Selection2 = Gui.Selection.getSelectionEx(m_actDoc.Name) try: SelectedObjects = Selection @@ -8460,6 +9285,10 @@ def object_alignFaces(): rot_center = Plane_Point rot_angle = m_angle + m_angleAlignFaces Draft.rotate(Parent_Plane,rot_angle,rot_center,rot_axis) + + # Reset the selection changed by Draft.rotate + reset_SelectedObjects(Selection2, info=0) + else: printError_msg(error_msg) except: @@ -8493,6 +9322,8 @@ def object_alignEdges(): if the Edge of the object selected is already aligned to the last one, a rotation of 180 deg is applied to the object. In this case the Axis of rotation is Z vector : Base.Vector(0, 0, 1) + + Two clicks will rotate by 180 deg. """ msg=verbose @@ -8502,7 +9333,9 @@ def object_alignEdges(): "All Edges will be aligned to the last one !" Selection = get_SelectedObjectsWithParent(info=msg, printError=False) - + m_actDoc=get_ActiveDocument(info=1) + Selection2 = Gui.Selection.getSelectionEx(m_actDoc.Name) + try: SelectedObjects = Selection Number_of_Edges = SelectedObjects[1] @@ -8550,6 +9383,8 @@ def object_alignEdges(): rot_center = Edge_Point rot_angle = m_angle + m_angleAlignEdges Draft.rotate(Parent_Edge,rot_angle,rot_center,rot_axis) + # Reset the selection changed by Draft.rotate + reset_SelectedObjects(Selection2, info=0) else: printError_msg(error_msg) except: @@ -8558,20 +9393,20 @@ def object_alignEdges(): def object_jointPoints(): """ + Joint Point(s) from selected object(s) to the last Point selected. + - Click first to select a Point of an object or several Points from several objects. + - Click second to select an Point to joint to. """ msg=verbose - msg=1 error_msg =\ "INCORRECT Object(s) Selection :\n" +\ - "You Must Select at least two(2) Points (from two objects) !\n" +\ + "You Must Select at least two(2) Points (from two different objects) !\n" +\ "All Points will be displaced onto the last one !" Selection = get_SelectedObjectsWithParent(info=msg, printError=False) try: - SelectedObjects = Selection - SelectedObjects = Selection Number_of_Points = SelectedObjects[0] if msg!=0: @@ -8611,6 +9446,118 @@ def object_jointPoints(): except: printError_msg(error_msg) + + +def object_jointFaces(): + """Joint Face(s) from selected object(s) to the last Face selected. + - Click first to select a Face of an object or several Faces from several objects. + - Click second to select an Face to joint to. + """ + msg=verbose + + createFolders('WorkPoints') + error_msg =\ + "INCORRECT Object(s) Selection :\n" +\ + "You Must Select at least two(2) Faces (from two different objects) !\n" +\ + "All Faces will be displaced onto the last one !" + + Selection = get_SelectedObjectsWithParent(info=msg, printError=False) + m_actDoc=get_ActiveDocument(info=1) + Selection2 = Gui.Selection.getSelectionEx(m_actDoc.Name) + + try: + SelectedObjects = Selection + Number_of_Planes = SelectedObjects[2] + if msg!=0: + print_msg("Number_of_Planes=" + str(Number_of_Planes)) + + if Number_of_Planes >= 2 : + Plane_List = SelectedObjects[5] + if msg != 0: + print_msg(" Plane_List=" + str(Plane_List)) + + Origin = Base.Vector(0, 0, 0) + # Get the Reference Plane : last of the selected + Ref_Plane_dict = Plane_List[-1] + for Selected_Plane, Parent_Plane in Ref_Plane_dict.iteritems(): + Plane_Point_ref = Selected_Plane.CenterOfMass + Plane_Normal_ref = Selected_Plane.normalAt(0,0) + if msg != 0: + print_point(Plane_Point_ref, msg="Reference Plane_Point = ") + print_point(Plane_Normal_ref, msg="Reference Plane_Normal = ") + point_User_Name = plot_point(Plane_Point_ref, part="Part::Feature", name="End", grp="WorkPoints") + Gui.ActiveDocument.getObject(point_User_Name).PointColor = (1.0,1.0,1.0) + + del Plane_List[-1] + + for Selected_Plane_dict in Plane_List: + if msg != 0: + print_msg("Selected_Plane_dict = " + str(Selected_Plane_dict)) + for Selected_Plane, Parent_Plane in Selected_Plane_dict.iteritems(): + if msg != 0: + print_msg("Selected_Plane = " + str(Selected_Plane)) + print_msg("Parent = " + str(Parent_Plane)) + try: + Plane_Point = Parent_Plane.Shape.BoundBox.Center + except: + Plane_Point = Selected_Plane.CenterOfMass + + Plane_Normal = Selected_Plane.normalAt(0,0) + Plane_Center = Selected_Plane.CenterOfMass + point = App.ActiveDocument.addObject( "Part::Feature", "Start" ) + point.Shape = Part.Vertex( Plane_Center ) + + if msg != 0: + print_point(Plane_Point, msg="Plane_Point = ") + print_point(Plane_Normal, msg="Plane_Normal = ") + point_User_Name = plot_point(Plane_Point, part="Part::Feature", name="Center_Rot", grp="WorkPoints") + Gui.ActiveDocument.getObject( point_User_Name ).PointColor = (0.0,0.0,1.0) +#============================================================================== +# # First align Faces +#============================================================================== + if colinearVectors(Plane_Normal, Origin, Plane_Normal_ref, info=msg, tolerance=1e-12): + if Plane_Normal == Plane_Normal_ref.multiply(-1): + Plane_Center = Selected_Plane.CenterOfMass + #else: + rot_axis = Base.Vector(0, 0, 1).cross(Plane_Normal) + rot_center = Plane_Point + rot_angle = 180. + Draft.rotate(Parent_Plane,rot_angle,rot_center,rot_axis) + Draft.rotate(point,rot_angle,rot_center,rot_axis) + Plane_Center = point.Shape.Point + else: + m_angle, m_angle_rad = angleBetween(Plane_Normal,Plane_Normal_ref) + rot_axis = Plane_Normal.cross(Plane_Normal_ref) + rot_center = Plane_Point + rot_angle = m_angle + Draft.rotate(Parent_Plane,rot_angle,rot_center,rot_axis) + Draft.rotate(point,rot_angle,rot_center,rot_axis) + Plane_Center = point.Shape.Point + if msg != 0: + print_msg("rotation done !") + # Reset the selection changed by Draft.rotate + reset_SelectedObjects(Selection2, info=0) + + if msg != 0: + point_User_Name = plot_point(Plane_Center, part="Part::Feature", name="Start", grp="WorkPoints") + Gui.ActiveDocument.getObject( point_User_Name ).PointColor = (0.0,0.0,1.0) + +#============================================================================== +# # Then Joint Faces +#============================================================================== + m_move = Plane_Point_ref.sub(Plane_Center) + m_oldplace = Parent_Plane.Placement + m_rot = m_oldplace.Rotation + m_base = m_oldplace.Base + m_newplace = App.Placement(m_base.add(m_move), m_rot ) + Parent_Plane.Placement = m_newplace + App.getDocument(str(App.activeDocument().Name)).removeObject(point.Label) + if msg != 0: + print_msg("move done !") + + except: + printError_msg(error_msg) + #################################################################################### try: @@ -8676,7 +9623,10 @@ class WorkFeatureTab(): ### Connect to functions self.connections_for_checkbox_toggled = { - "checkBox_object_center" : "bBox_toggled", + "checkBox_object_center" : "bBox_toggled", + "checkBox_solid" : "solid_toggled", + "checkBox_allsubselect" : "subselect_toggled", + "checkBox_volumBB" : "volumBBox_toggled", } self.connections_for_button_clicked = { "button_WF_quit" : "quit_clicked", @@ -8752,6 +9702,7 @@ class WorkFeatureTab(): "button_dome_create" : "plot_centerDome", "button_letter" : "plot_letter", "button_revolve" : "plot_revolution", + "button_sweep" : "plot_sectionSweep", "button_alignview" : "view_align", "button_trackcamera" : "view_trackCamera", @@ -8775,7 +9726,8 @@ class WorkFeatureTab(): "button_alignface2view" : "object_align2view", "button_align_faces" : "object_alignFaces", "button_align_edges" : "object_alignEdges", - "button_joint_points" : "object_jointPoints", + "button_joint_points" : "object_jointPoints", + "button_joint_faces" : "object_jointFaces", } self.connections_for_text_changed = { @@ -8835,10 +9787,12 @@ class WorkFeatureTab(): "radioButton_verbose" : "verbose_toggled", "radioButton_biColor" : "biColor_toggled", "radioButton_copy" : "copy_toggled", + "radioButton_Frenet" : "frenet_toggled", } self.connections_for_combobox_changed = { "point_loc_comboBox" : "attachPoint", + "transition_comboBox" : "transition", }