Proxy class for a DocumentObjectGroupPython
RobWorld instance.
More...
Proxy class for a DocumentObjectGroupPython
RobWorld instance.
A RobWorldProxy instance adds properties to a DocumentObjectGroupPython
RobWorld instance and responds to their changes.
To connect this Proxy
object to a DocumentObjectGroupPython
RobWorld do:
a = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",
"RobWorld")
RobWorldProxy(a)
Definition at line 60 of file RobWorld.py.
◆ __init__()
def RobWorld.RobWorldProxy.__init__ |
( |
|
self, |
|
|
|
fp |
|
) |
| |
Initialization method for RobWorldProxy.
A class instance is created and made a Proxy
for a generic DocumentObjectGroupPython
RobWorld object. During initialization number of properties are specified and preset.
- Parameters
-
fp | A DocumentObjectGroupPython RobWorld object to be extended. |
Definition at line 72 of file RobWorld.py.
72 def __init__(self, fp):
74 self.setProperties(fp)
◆ execute()
def RobWorld.RobWorldProxy.execute |
( |
|
self, |
|
|
|
fp |
|
) |
| |
Method called when recomputing a DocumentObjectGroupPython
.
Placement is computed from Yaw, Pitch and Roll angle rotations about Z, Y and X axes originating in (0, 0, 0).
- Parameters
-
fp | A DocumentObjectGroupPython RobWorld object. |
Definition at line 105 of file RobWorld.py.
105 def execute(self, fp):
106 rotation = FreeCAD.Rotation(fp.AngleYaw, fp.AnglePitch, fp.AngleRoll)
107 rotation_center = FreeCAD.Vector(0, 0, 0)
108 position = FreeCAD.Vector(fp.PositionX, fp.PositionY, fp.PositionZ)
109 fp.Placement = FreeCAD.Placement(position, rotation, rotation_center)
◆ onChanged()
def RobWorld.RobWorldProxy.onChanged |
( |
|
self, |
|
|
|
fp, |
|
|
|
prop |
|
) |
| |
Method called after DocumentObjectGroupPython
RobWorld was changed.
A RobWorld is checked for its validity. If the Placement
property is changed, then ParentFramePlacement
property of a RobWorld
's children is set to equal the new Placement
.
- Parameters
-
fp | A DocumentObjectGroupPython RobWorld object. |
prop | A str name of a changed property. |
Definition at line 88 of file RobWorld.py.
88 def onChanged(self, fp, prop):
89 if prop ==
"Placement":
91 if hasattr(fp,
"Group")
and len(fp.Group) != 0:
92 for child
in fp.Group:
93 child.ParentFramePlacement = fp.Placement
◆ onDocumentRestored()
def RobWorld.RobWorldProxy.onDocumentRestored |
( |
|
self, |
|
|
|
fp |
|
) |
| |
Method called when document is restored to make sure everything is as it was.
Reinitialization it creates properties and sets them to default, if they were not restored automatically. Properties of connected ViewObject
are also recreated and reset if necessary.
- Parameters
-
fp | A restored DocumentObjectGroupPython RobWorld object. |
Definition at line 121 of file RobWorld.py.
121 def onDocumentRestored(self, fp):
122 fp.ViewObject.Proxy.setProperties(fp.ViewObject)
123 self.setProperties(fp)
◆ setProperties()
def RobWorld.RobWorldProxy.setProperties |
( |
|
self, |
|
|
|
fp |
|
) |
| |
Method to set properties during initialization or document restoration.
The properties are set if they are not already present and an AnimateDocumentObserver
is recreated.
- Parameters
-
fp | A restored or barebone DocumentObjectGroupPython RobWorld object. |
Definition at line 135 of file RobWorld.py.
135 def setProperties(self, fp):
138 if not hasattr(fp,
"AllowServer"):
139 fp.addProperty(
"App::PropertyBool",
"AllowServer",
"General",
140 "Should this object allow a Server object to " 141 +
"change it.").AllowServer =
True 144 if not hasattr(fp,
"PositionX"):
145 fp.addProperty(
"App::PropertyFloat",
"PositionX",
"FramePlacement",
146 "X position of the world frame.").PositionX = 0
147 if not hasattr(fp,
"PositionY"):
148 fp.addProperty(
"App::PropertyFloat",
"PositionY",
"FramePlacement",
149 "Y position of the world frame.").PositionY = 0
150 if not hasattr(fp,
"PositionZ"):
151 fp.addProperty(
"App::PropertyFloat",
"PositionZ",
"FramePlacement",
152 "Z position of the world frame.").PositionZ = 0
153 if not hasattr(fp,
"AngleYaw"):
154 fp.addProperty(
"App::PropertyFloat",
"AngleYaw",
"FramePlacement",
155 "Yaw angle (rotation about Z axis) of the world" 156 +
" frame in degrees.").AngleYaw = 0
157 if not hasattr(fp,
"AnglePitch"):
158 fp.addProperty(
"App::PropertyFloat",
"AnglePitch",
159 "FramePlacement",
"Pitch angle (rotation about Y" 160 +
" axis) of the world frame in degrees." 162 if not hasattr(fp,
"AngleRoll"):
163 fp.addProperty(
"App::PropertyFloat",
"AngleRoll",
"FramePlacement",
164 "Roll angle (rotation about X axis) of the world" 165 +
" frame in degrees.").AngleRoll = 0
168 if not hasattr(fp,
"ShowFrame"):
169 fp.addProperty(
"App::PropertyBool",
"ShowFrame",
"Frame",
170 "Show a frame for current pose." 172 if not hasattr(fp,
"FrameTransparency"):
173 fp.addProperty(
"App::PropertyPercent",
"FrameTransparency",
174 "Frame",
"Transparency of the frame in percents." 175 ).FrameTransparency = 0
176 if not hasattr(fp,
"ShowFrameArrowheads"):
177 fp.addProperty(
"App::PropertyBool",
"ShowFrameArrowheads",
"Frame",
178 "Show arrowheads for frame axis arrow's." 179 ).ShowFrameArrowheads =
True 180 if not hasattr(fp,
"FrameArrowheadLength"):
181 fp.addProperty(
"App::PropertyFloatConstraint",
182 "FrameArrowheadLength",
"Frame",
183 "Frame axis arrow's arrowhead length.\n" 184 +
"Range is < 1.0 | 1e6 >." 185 ).FrameArrowheadLength = (10, 1.0, 1e6, 1)
187 fp.FrameArrowheadLength = (fp.FrameArrowheadLength, 1.0, 1e6, 1)
188 if not hasattr(fp,
"FrameArrowheadRadius"):
189 fp.addProperty(
"App::PropertyFloatConstraint",
190 "FrameArrowheadRadius",
"Frame",
191 "Frame axis arrow's arrowhead bottom radius.\n" 192 +
"Range is < 0.5 | 1e6 >." 193 ).FrameArrowheadRadius = (5, 0.5, 1e6, 0.5)
195 fp.FrameArrowheadRadius = (fp.FrameArrowheadRadius, 0.5, 1e6, 0.5)
196 if not hasattr(fp,
"ShaftLength"):
197 fp.addProperty(
"App::PropertyFloatConstraint",
"ShaftLength",
198 "Frame",
"Frame axis arrow's shaft length.\n" 199 +
"Range is < 1.0 | 1e6 >." 200 ).ShaftLength = (20, 1.0, 1e6, 1)
202 fp.ShaftLength = (fp.ShaftLength, 1.0, 1e6, 1)
203 if not hasattr(fp,
"ShaftWidth"):
204 fp.addProperty(
"App::PropertyFloatConstraint",
"ShaftWidth",
205 "Frame",
"Frame axis arrow's shaft width.\n" 206 +
"Range is < 1.0 | 64 >." 207 ).ShaftWidth = (4, 1.0, 64, 1)
209 fp.ShaftWidth = (fp.ShaftWidth, 1.0, 64, 1)
210 if not hasattr(fp,
"ShowFrameLabels"):
211 fp.addProperty(
"App::PropertyBool",
"ShowFrameLabels",
212 "Frame",
"Show label for frame axes." 213 ).ShowFrameLabels =
True 216 if not hasattr(fp,
"FontSize"):
217 fp.addProperty(
"App::PropertyIntegerConstraint",
"FontSize",
218 "Labels",
"Label font size.\n" 219 +
"Range is < 1 | 100 >." 220 ).FontSize = (10, 1, 100, 1)
222 fp.FontSize = (fp.FontSize, 1, 100, 1)
223 if not hasattr(fp,
"DistanceToAxis"):
224 fp.addProperty(
"App::PropertyFloatConstraint",
"DistanceToAxis",
225 "Labels",
"Distance from label to its axis.\n" 226 +
"Range is < 0.5 | 1e6 >." 227 ).DistanceToAxis = (5, 0.5, 1e6, 0.5)
229 fp.DistanceToAxis = (fp.DistanceToAxis, 0.5, 1e6, 0.5)
230 if not hasattr(fp,
"Subscription"):
231 fp.addProperty(
"App::PropertyString",
"Subscription",
"Labels",
232 "Subscription added to an axis name." 234 if not hasattr(fp,
"Superscription"):
235 fp.addProperty(
"App::PropertyString",
"Superscription",
"Labels",
236 "Superscription added to an axis name." 237 ).Superscription =
"" 238 if not hasattr(fp,
"FontFamily"):
239 fp.addProperty(
"App::PropertyEnumeration",
"FontFamily",
240 "Labels",
"Label font family." 241 ).FontFamily = [
"SERIF",
"SANS",
"TYPEWRITER"]
242 if not hasattr(fp,
"FontStyle"):
243 fp.addProperty(
"App::PropertyEnumeration",
"FontStyle",
244 "Labels",
"Label font style." 245 ).FontStyle = [
"NONE",
"BOLD",
"ITALIC",
249 if not hasattr(fp,
"Placement"):
250 fp.addProperty(
"App::PropertyPlacement",
"Placement",
"Base",
251 "Current placement for animated objects in " 255 fp.setEditorMode(
"Placement", 2)
257 import AnimateDocumentObserver
def addObserver()
Adds an AnimateDocumentObserver between FreeCAD's document observers safely.
The documentation for this class was generated from the following file: