38 from PySide2.QtWidgets
import QDialogButtonBox
39 from PySide2.QtCore
import QObject
81 for joint
in robot_joints:
82 if joint.Proxy.__class__.__name__ ==
"RobRotationProxy":
84 joint.setEditorMode(
"ValidRotation", 2)
85 elif joint.Proxy.__class__.__name__ ==
"RobTranslationProxy":
87 joint.setEditorMode(
"ValidTranslation", 2)
89 for prop
in joint.PropertiesList:
90 joint.setEditorMode(prop, 1)
91 joint.setEditorMode(
"Placement", 2)
92 joint.setEditorMode(
"RobotPanelActive", 2)
93 joint.RobotPanelActive =
True 100 for i
in range(len(forms)):
102 forms[i].sld_value.valueChanged.connect(
103 lambda value, form=forms[i], joint=rj:
105 if rj.Proxy.__class__.__name__ ==
"RobRotationProxy":
106 val = (100 * (rj.theta - rj.thetaOffset - rj.thetaMinimum)) / \
107 (rj.thetaMaximum - rj.thetaMinimum)
108 val = min([100, max([val, 0])])
109 elif rj.Proxy.__class__.__name__ ==
"RobTranslationProxy":
110 val = (100 * (rj.d - rj.dOffset - rj.dMinimum)) / \
111 (rj.dMaximum - rj.dMinimum)
112 val = min([100, max([val, 0])])
114 forms[i].sld_value.setValue(val)
130 if joint.Proxy.__class__.__name__ ==
"RobRotationProxy":
131 val = value * (joint.thetaMaximum - joint.thetaMinimum) / 100 \
132 + joint.thetaMinimum + joint.thetaOffset
134 elif joint.Proxy.__class__.__name__ ==
"RobTranslationProxy":
135 val = value * (joint.dMaximum - joint.dMinimum) / 100 \
136 + joint.dMinimum + joint.dOffset
139 form.lbl_value.setText(
"Value: " + (
"%5.3f" % val))
142 FreeCAD.ActiveDocument.recompute()
143 FreeCADGui.updateGui()
158 ==
"RobRotationProxy":
161 ==
"RobTranslationProxy":
167 for prop
in joint.PropertiesList:
168 joint.setEditorMode(prop, 0)
169 joint.ViewObject.Proxy.panel =
None 173 joint.setEditorMode(
"ObjectPlacement", 1)
174 joint.setEditorMode(
"ParentFramePlacement", 1)
175 if joint.Proxy.__class__.__name__ ==
"RobRotationProxy":
176 joint.setEditorMode(
"theta", 1)
177 joint.setEditorMode(
"ValidRotation", 2)
178 elif joint.Proxy.__class__.__name__ ==
"RobTranslationProxy":
179 joint.setEditorMode(
"d", 1)
180 joint.setEditorMode(
"ValidTranslation", 2)
181 joint.setEditorMode(
"Placement", 2)
182 joint.setEditorMode(
"RobotPanelActive", 2)
183 joint.RobotPanelActive =
False 185 FreeCADGui.Control.closeDialog()
186 FreeCAD.ActiveDocument.recompute()
187 FreeCADGui.updateGui()
196 return QDialogButtonBox.Close
def __init__(self, robot_joints, forms)
Initialization method for RobotPanel.
def reject(self)
Feedback method called when 'Close' button was pressed to close the panel.
def isAllowedAlterDocument(self)
Method to tell FreeCAD if dialog is allowed to alter a document.
def getStandardButtons(self, *args)
Method to set just one button (close) to close the dialog.
robot_joints
A list of RobRotation and RobTranslation instances.
def isAllowedAlterView(self)
Method to tell FreeCAD if dialog is allowed to alter a view.
def isAllowedAlterSelection(self)
Method to tell FreeCAD if dialog is allowed to alter a selection.
def sliderChanged(self, value, form, joint)
Feedback method called when any slider position is changed.
Class providing funcionality to a RobRotation panel inside the TaskView.
form
A list of QDialog instances to show in the TaskView.