Trajectory.TrajectoryProxy Class Reference

Proxy class for a DocumentObjectGroupPython Trajectory instance. More...

Public Member Functions

def __init__ (self, fp)
 Initialization method for TrajectoryProxy. More...
 
def onChanged (self, fp, prop)
 Method called after DocumentObjectGroupPython Trajectory was changed. More...
 
def execute (self, fp)
 Method called when recomputing a DocumentObjectGroupPython. More...
 
def onDocumentRestored (self, fp)
 Method called when document is restored to make sure everything is as it was. More...
 
def setProperties (self, fp)
 Method to set properties during initialization or document restoration. More...
 
def change_trajectory (self, fp, traj)
 Method used to change a Trajectory's trajectory. More...
 
def is_trajectory_property (self, prop)
 Method to check that a property describes a trajectory. More...
 
def is_ValidTrajectory (self, timestamps=[], translation_x=[], translation_y=[], translation_z=[], rotation_point_x=[], rotation_point_y=[], rotation_point_z=[], rotation_axis_x=[], rotation_axis_y=[], rotation_axis_z=[], rotation_angle=[], trajectory=None)
 Method to check if a trajectory is valid. More...
 
def find_timestamp_indices_and_weights (self, fp)
 Method to find weighted timestamps indices corresponding to a given time. More...
 

Public Attributes

 pose
 A dict describing a pose - position, rotation axis, point and angle. More...
 

Detailed Description

Proxy class for a DocumentObjectGroupPython Trajectory instance.

A TrajectoryProxy instance adds properties to a DocumentObjectGroupPython Trajectory instance and responds to their changes. It provides a TrajectoryPanel to be able to see an object progress through a trajectory.

To connect this Proxy object to a DocumentObjectGroupPython Trajectory do:

a = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",
"Trajectory")
TrajectoryProxy(a)

Definition at line 244 of file Trajectory.py.

Constructor & Destructor Documentation

◆ __init__()

def Trajectory.TrajectoryProxy.__init__ (   self,
  fp 
)

Initialization method for TrajectoryProxy.

A class instance is created and made a Proxy for a generic DocumentObjectGroupPython Trajectory object. During initialization number of properties are specified and preset.

Parameters
fpA DocumentObjectGroupPython Trajectory object to be extended.

Definition at line 259 of file Trajectory.py.

259  def __init__(self, fp):
260  # Add (and preset) properties
261  self.setProperties(fp)
262  fp.Proxy = self
263 

Member Function Documentation

◆ change_trajectory()

def Trajectory.TrajectoryProxy.change_trajectory (   self,
  fp,
  traj 
)

Method used to change a Trajectory's trajectory.

A traj dictionary containing a trajectory is tested for validity and then assigned to a Trajectory DocumentObjectGroupPython.

Parameters
fpA DocumentObjectGroupPython Trajectory object.
trajA dictionary describing a trajectory.

Definition at line 631 of file Trajectory.py.

631  def change_trajectory(self, fp, traj):
632  # Check that trajectory has a correct format and load it
633  if self.is_ValidTrajectory(trajectory=traj):
634  fp.RotationAngle = traj["RotationAngle"]
635  fp.RotationAxisX = traj["RotationAxisX"]
636  fp.RotationAxisY = traj["RotationAxisY"]
637  fp.RotationAxisZ = traj["RotationAxisZ"]
638  fp.RotationPointX = traj["RotationPointX"]
639  fp.RotationPointY = traj["RotationPointY"]
640  fp.RotationPointZ = traj["RotationPointZ"]
641  fp.TranslationX = traj["TranslationX"]
642  fp.TranslationY = traj["TranslationY"]
643  fp.TranslationZ = traj["TranslationZ"]
644  fp.Timestamps = traj["Timestamps"]
645  else:
646  FreeCAD.Console.PrintError("Invalid trajectory!")
647 

◆ execute()

def Trajectory.TrajectoryProxy.execute (   self,
  fp 
)

Method called when recomputing a DocumentObjectGroupPython.

If a trajectory is valid, then current pose in a parent coordinate frame is computed, ObjectPlacement and Placement are updated accordingly.

Parameters
fpA DocumentObjectGroupPython Trajectory object.

Definition at line 316 of file Trajectory.py.

316  def execute(self, fp):
317  # Check that current trajectory has valid format
318  if not fp.ValidTrajectory:
319  FreeCAD.Console.PrintWarning(fp.Name + ".execute(): Trajectory " +
320  "is not in a valid format.\n")
321  return
322 
323  # Update placement according to current time and trajectory
324  indices, weights = self.find_timestamp_indices_and_weights(fp)
325 
326  self.pose["position"] = (weights[0]*fp.TranslationX[indices[0]] +
327  weights[1]*fp.TranslationX[indices[1]],
328  weights[0]*fp.TranslationY[indices[0]] +
329  weights[1]*fp.TranslationY[indices[1]],
330  weights[0]*fp.TranslationZ[indices[0]] +
331  weights[1]*fp.TranslationZ[indices[1]])
332  self.pose["rot_axis"] = (weights[0]*fp.RotationAxisX[indices[0]]
333  + weights[1]*fp.RotationAxisX[indices[1]],
334  weights[0]*fp.RotationAxisY[indices[0]]
335  + weights[1]*fp.RotationAxisY[indices[1]],
336  weights[0]*fp.RotationAxisZ[indices[0]]
337  + weights[1]*fp.RotationAxisZ[indices[1]])
338  self.pose["rot_point"] = (weights[0]*fp.RotationPointX[indices[0]]
339  + weights[1]*fp.RotationPointX[indices[1]],
340  weights[0]*fp.RotationPointY[indices[0]]
341  + weights[1]*fp.RotationPointY[indices[1]],
342  weights[0]*fp.RotationPointZ[indices[0]]
343  + weights[1]*fp.RotationPointZ[indices[1]])
344  self.pose["rot_angle"] = (weights[0]*fp.RotationAngle[indices[0]]
345  + weights[1]*fp.RotationAngle[indices[1]])
346 
347  fp.ObjectPlacement = FreeCAD.Placement(
348  FreeCAD.Vector(self.pose["position"][0],
349  self.pose["position"][1],
350  self.pose["position"][2]),
351  FreeCAD.Rotation(FreeCAD.Vector(self.pose["rot_axis"][0],
352  self.pose["rot_axis"][1],
353  self.pose["rot_axis"][2]),
354  self.pose["rot_angle"]),
355  FreeCAD.Vector(self.pose["rot_point"][0],
356  self.pose["rot_point"][1],
357  self.pose["rot_point"][2],))
358  fp.Placement = fp.ParentFramePlacement.multiply(
359  fp.ObjectPlacement)
360 

◆ find_timestamp_indices_and_weights()

def Trajectory.TrajectoryProxy.find_timestamp_indices_and_weights (   self,
  fp 
)

Method to find weighted timestamps indices corresponding to a given time.

If a time is smaller than the first timestamp, the returned indices are [0,0] with weights [1,0] as that's the closest value. Similarly, if the time is greater than the last timestamp, the returned indices are [-1,-1] pointing to the last element of a timestamps list with weights [1,0]. If the time value is between the first and last timestamp, the indices belong to the closest higher and lower time. At the same time, if interpolation is off, the weights are 0 and 1, where one is given to the index closest to the time. Otherwise, the weights, whose sum equals to 1, are computed to show inverse relative distance i.e. an index with a greater weight is the closer.

Parameters
fpA DocumentObjectGroupPython Trajectory object.
Returns
indices A list of two integers between -1 and and length of Timestamps.
weights A list of two floats between 0 and 1 showing relative closeness.

Definition at line 777 of file Trajectory.py.

777  def find_timestamp_indices_and_weights(self, fp):
778  # Retrieve indices corresponding to current time
779  # If the time is before the first Timestamp use the first Timestamp
780  if fp.Time <= fp.Timestamps[0]:
781  indices = [0, 0]
782  weights = [1, 0]
783 
784  # If the time is after the last Timpestamp use the last Timestamp
785  elif fp.Time >= fp.Timestamps[-1]:
786  indices = [-1, -1]
787  weights = [1, 0]
788 
789  # If time is in the range of Timesteps
790  else:
791  # Find the index of the closest higher value
792  indices = [bisect(fp.Timestamps, fp.Time)]
793  # Add the previous index
794  indices.insert(0, indices[0]-1)
795  weights = [fp.Timestamps[indices[1]] - fp.Time,
796  fp.Time - fp.Timestamps[indices[0]]]
797  if not fp.Interpolate:
798  if weights[0] > weights[1]:
799  weights = [1, 0]
800  else:
801  weights = [0, 1]
802  else:
803  weights = [weights[0]/sum(weights), weights[1]/sum(weights)]
804 
805  return indices, weights
806 
807 

◆ is_trajectory_property()

def Trajectory.TrajectoryProxy.is_trajectory_property (   self,
  prop 
)

Method to check that a property describes a trajectory.

It's checked whether prop is Timestamps, TranslationX, TranslationY, TranslationZ, RotationPointX, RotationPointY, RotationPointZ, RotationAxisX, RotationAxisY, RotationAxisZ or RotationAngle.

Parameters
propA str name of a changed property.
Returns
True if prop describes a trajectory and False otherwise.

Definition at line 661 of file Trajectory.py.

661  def is_trajectory_property(self, prop):
662  return prop in ["Timestamps", "TranslationX", "TranslationY",
663  "TranslationZ", "RotationPointX", "RotationPointY",
664  "RotationPointZ", "RotationAxisX", "RotationAxisY",
665  "RotationAxisZ", "RotationAngle"]
666 

◆ is_ValidTrajectory()

def Trajectory.TrajectoryProxy.is_ValidTrajectory (   self,
  timestamps = [],
  translation_x = [],
  translation_y = [],
  translation_z = [],
  rotation_point_x = [],
  rotation_point_y = [],
  rotation_point_z = [],
  rotation_axis_x = [],
  rotation_axis_y = [],
  rotation_axis_z = [],
  rotation_angle = [],
  trajectory = None 
)

Method to check if a trajectory is valid.

This method needs either a trajectory dictionary argument or all the other lists of floats. A valid trajectory needs to have all the necessary lists. All the lists must have same length. A timestamps list must consist of a sequence of strictly increasing floats. A rotation axis must have always length equal to 1.

Parameters
timestampsA list of floats marking timestamps.
translation_xA list of floats signifying translations in X direction.
translation_yA list of floats signifying translations in Y direction.
translation_zA list of floats signifying translations in Z direction.
rotation_point_xA list of floats signifying rotation point X coordinates.
rotation_point_yA list of floats signifying rotation point Y coordinates.
rotation_point_zA list of floats signifying rotation point Z coordinates.
rotation_axis_xA list of floats signifying rotation axis X elements.
rotation_axis_yA list of floats signifying rotation axis Y elements.
rotation_axis_zA list of floats signifying rotation axis Z elements.
rotation_angleA list of floats signifying rotation angles.
trajectoryA dict containing all lists above.
Returns
True if trajectory is valid and False otherwise.

Definition at line 693 of file Trajectory.py.

693  def is_ValidTrajectory(self, timestamps=[], translation_x=[],
694  translation_y=[], translation_z=[],
695  rotation_point_x=[], rotation_point_y=[],
696  rotation_point_z=[], rotation_axis_x=[],
697  rotation_axis_y=[], rotation_axis_z=[],
698  rotation_angle=[], trajectory=None):
699  # Check all keys are included and record lengths of their lists
700  if trajectory is not None and isinstance(trajectory, dict):
701  for key in ["Timestamps", "TranslationX", "TranslationY",
702  "TranslationZ", "RotationPointX", "RotationPointY",
703  "RotationPointZ", "RotationAxisX", "RotationAxisY",
704  "RotationAxisZ", "RotationAngle"]:
705  if key not in trajectory.keys():
706  FreeCAD.Console.PrintWarning("Trajectory misses key " +
707  key + ".\n")
708  return False
709  timestamps = trajectory["Timestamps"]
710  translation_x = trajectory["TranslationX"]
711  translation_y = trajectory["TranslationY"]
712  translation_z = trajectory["TranslationZ"]
713  rotation_point_x = trajectory["RotationPointX"]
714  rotation_point_y = trajectory["RotationPointY"]
715  rotation_point_z = trajectory["RotationPointZ"]
716  rotation_axis_x = trajectory["RotationAxisX"]
717  rotation_axis_y = trajectory["RotationAxisY"]
718  rotation_axis_z = trajectory["RotationAxisZ"]
719  rotation_angle = trajectory["RotationAngle"]
720 
721  # Check that all lists have the same length
722  if len(timestamps) == 0 or \
723  (len(timestamps) != 0 and
724  (len(timestamps) != len(timestamps) or
725  len(timestamps) != len(translation_x) or
726  len(timestamps) != len(translation_y) or
727  len(timestamps) != len(translation_z) or
728  len(timestamps) != len(rotation_point_x) or
729  len(timestamps) != len(rotation_point_y) or
730  len(timestamps) != len(rotation_point_z) or
731  len(timestamps) != len(rotation_axis_x) or
732  len(timestamps) != len(rotation_axis_y) or
733  len(timestamps) != len(rotation_axis_z) or
734  len(timestamps) != len(rotation_angle))):
735  FreeCAD.Console.PrintWarning("Trajectory has lists with "
736  + "inconsistent or zero "
737  + "lengths.\n")
738  return False
739 
740  # Check timestamps correspond to list of increasing values
741  if any([timestamps[i] >= timestamps[i+1]
742  for i in range(len(timestamps)-1)]):
743  FreeCAD.Console.PrintWarning("Trajectory 'Timestamps' is not "
744  + "list of increasing values.\n")
745  return False
746 
747  if any([sum([rotation_axis_x[i]**2,
748  rotation_axis_y[i]**2,
749  rotation_axis_z[i]**2]) != 1
750  for i in range(len(rotation_axis_x))]):
751  FreeCAD.Console.PrintWarning("Trajectory 'Rotation Axis' "
752  + "elements don't have norm 1.\n")
753  return False
754 
755  return True
756 

◆ onChanged()

def Trajectory.TrajectoryProxy.onChanged (   self,
  fp,
  prop 
)

Method called after DocumentObjectGroupPython Trajectory was changed.

A trajectory is checked for its validity. If the Placement property is changed, then ParentFramePlacement property of a Trajectory children is set to equal the new Placement. If the ParentFramePlacement is changed, then the Placement property is changed.

Parameters
fpA DocumentObjectGroupPython Trajectory object.
propA str name of a changed property.

Definition at line 276 of file Trajectory.py.

276  def onChanged(self, fp, prop):
277  # Check that a trajectory has valid format
278  if self.is_trajectory_property(prop):
279  traj_valid = self.is_ValidTrajectory(
280  fp.Timestamps, fp.TranslationX, fp.TranslationY,
281  fp.TranslationZ, fp.RotationPointX, fp.RotationPointY,
282  fp.RotationPointZ, fp.RotationAxisX, fp.RotationAxisY,
283  fp.RotationAxisZ, fp.RotationAngle)
284 # traj_valid = self.is_ValidTrajectory(trajectory=traj)
285  if traj_valid != fp.ValidTrajectory:
286  fp.ValidTrajectory = traj_valid
287 
288  elif prop == "Placement":
289  # Propagate the Placement updates down the chain
290  if hasattr(fp, "Group") and len(fp.Group) != 0:
291  for child in fp.Group:
292  child.ParentFramePlacement = fp.Placement
293  child.purgeTouched()
294 
295  # Display animated objects in a pose specified by the trajectory
296  # and current time
297  if hasattr(fp, "AnimatedObjects") and len(fp.AnimatedObjects) != 0:
298  for o in fp.AnimatedObjects:
299  o.Placement = fp.Placement
300  o.purgeTouched()
301 
302  elif prop == "ParentFramePlacement":
303  # If parent frame changed, recompute placement
304  fp.Placement = fp.ParentFramePlacement.multiply(
305  fp.ObjectPlacement)
306 

◆ onDocumentRestored()

def Trajectory.TrajectoryProxy.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
fpA restored DocumentObjectGroupPython Trajectory object.

Definition at line 371 of file Trajectory.py.

371  def onDocumentRestored(self, fp):
372  fp.ViewObject.Proxy.setProperties(fp.ViewObject)
373  self.setProperties(fp)
374 

◆ setProperties()

def Trajectory.TrajectoryProxy.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
fpA restored or barebone DocumentObjectGroupPython Trajectory object.

Definition at line 385 of file Trajectory.py.

385  def setProperties(self, fp):
386  self.pose = {"position": (0, 0, 0),
387  "rot_axis": (0, 0, 0),
388  "rot_point": (0, 0, 0),
389  "rot_angle": None}
390 
391  # Add (and preset) properties
392  # Animation properties
393  if not hasattr(fp, "ValidTrajectory"):
394  fp.addProperty("App::PropertyBool", "ValidTrajectory", "General",
395  "This property records if trajectory was changed."
396  ).ValidTrajectory = False
397  if not hasattr(fp, "AnimatedObjects"):
398  fp.addProperty("App::PropertyLinkListGlobal", "AnimatedObjects",
399  "General", "Objects that will be animated.")
400  if not hasattr(fp, "Interpolate"):
401  fp.addProperty("App::PropertyBool", "Interpolate", "General",
402  "Interpolate trajectory between timestamps."
403  ).Interpolate = True
404  if not hasattr(fp, "AllowServer"):
405  fp.addProperty("App::PropertyBool", "AllowServer", "General",
406  "Should this object allow a Server object to "
407  + "change it.").AllowServer = True
408  if not hasattr(fp, "AllowControl"):
409  fp.addProperty("App::PropertyBool", "AllowControl", "General",
410  "Should this object allow a Control object "
411  + " to change it."
412  ).AllowControl = True
413  if not hasattr(fp, "Time"):
414  fp.addProperty("App::PropertyFloat", "Time", "General",
415  "Animation time in seconds.").Time = 0
416  if not hasattr(fp, "ParentFramePlacement"):
417  fp.addProperty("App::PropertyPlacement", "ParentFramePlacement",
418  "General", "Current placement of a Parent Frame.")
419  if not hasattr(fp, "ObjectPlacement"):
420  fp.addProperty("App::PropertyPlacement", "ObjectPlacement",
421  "General",
422  "Current Object placement in a Parent Frame.")
423 
424  # Trajectory properties
425  if not hasattr(fp, "Timestamps"):
426  fp.addProperty("App::PropertyFloatList", "Timestamps",
427  "Trajectory", "Timestamps at which we define\n" +
428  "translation and rotation.")
429  if not hasattr(fp, "TranslationX"):
430  fp.addProperty("App::PropertyFloatList", "TranslationX",
431  "Trajectory",
432  "Object translation along global X direction.")
433  if not hasattr(fp, "TranslationY"):
434  fp.addProperty("App::PropertyFloatList", "TranslationY",
435  "Trajectory",
436  "Object translation along global Y direction.")
437  if not hasattr(fp, "TranslationZ"):
438  fp.addProperty("App::PropertyFloatList", "TranslationZ",
439  "Trajectory",
440  "Object translation along global Z direction.")
441 
442  if not hasattr(fp, "RotationPointX"):
443  fp.addProperty("App::PropertyFloatList", "RotationPointX",
444  "Trajectory",
445  "Object rotation point X coordinate.")
446  if not hasattr(fp, "RotationPointY"):
447  fp.addProperty("App::PropertyFloatList", "RotationPointY",
448  "Trajectory",
449  "Object rotation point Y coordinate.")
450  if not hasattr(fp, "RotationPointZ"):
451  fp.addProperty("App::PropertyFloatList", "RotationPointZ",
452  "Trajectory",
453  "Object rotation point Z coordinate.")
454 
455  if not hasattr(fp, "RotationAxisX"):
456  fp.addProperty("App::PropertyFloatList", "RotationAxisX",
457  "Trajectory", "Object rotation axis component X.")
458  if not hasattr(fp, "RotationAxisY"):
459  fp.addProperty("App::PropertyFloatList", "RotationAxisY",
460  "Trajectory", "Object rotation axis component Y.")
461  if not hasattr(fp, "RotationAxisZ"):
462  fp.addProperty("App::PropertyFloatList", "RotationAxisZ",
463  "Trajectory", "Object rotation axis component Z.")
464  if not hasattr(fp, "RotationAngle"):
465  fp.addProperty("App::PropertyFloatList", "RotationAngle",
466  "Trajectory",
467  "Rotation angle in degrees.")
468 
469  # Frame properties
470  if not hasattr(fp, "ShowFrame"):
471  fp.addProperty("App::PropertyBool", "ShowFrame", "Frame",
472  "Show a frame for current pose."
473  ).ShowFrame = True
474  if not hasattr(fp, "FrameTransparency"):
475  fp.addProperty("App::PropertyPercent", "FrameTransparency",
476  "Frame", "Transparency of the frame in percents."
477  ).FrameTransparency = 0
478  if not hasattr(fp, "ShowFrameArrowheads"):
479  fp.addProperty("App::PropertyBool", "ShowFrameArrowheads", "Frame",
480  "Show arrowheads for frame axis arrow's."
481  ).ShowFrameArrowheads = True
482  if not hasattr(fp, "FrameArrowheadLength"):
483  fp.addProperty("App::PropertyFloatConstraint",
484  "FrameArrowheadLength", "Frame",
485  "Frame axis arrow's arrowhead length.\n"
486  + "Range is < 1.0 | 1e6 >."
487  ).FrameArrowheadLength = (10, 1.0, 1e6, 1)
488  else:
489  fp.FrameArrowheadLength = (fp.FrameArrowheadLength, 1.0, 1e6, 1)
490  if not hasattr(fp, "FrameArrowheadRadius"):
491  fp.addProperty("App::PropertyFloatConstraint",
492  "FrameArrowheadRadius", "Frame",
493  "Frame axis arrow's arrowhead bottom radius.\n"
494  + "Range is < 0.5 | 1e6 >."
495  ).FrameArrowheadRadius = (5, 0.5, 1e6, 0.5)
496  else:
497  fp.FrameArrowheadRadius = (fp.FrameArrowheadRadius, 0.5, 1e6, 0.5)
498  if not hasattr(fp, "ShaftLength"):
499  fp.addProperty("App::PropertyFloatConstraint", "ShaftLength",
500  "Frame", "Frame axis arrow's shaft length.\n"
501  + "Range is < 1.0 | 1e6 >."
502  ).ShaftLength = (20, 1.0, 1e6, 1)
503  else:
504  fp.ShaftLength = (fp.ShaftLength, 1.0, 1e6, 1)
505  if not hasattr(fp, "ShaftWidth"):
506  fp.addProperty("App::PropertyFloatConstraint", "ShaftWidth",
507  "Frame", "Frame axis arrow's shaft width.\n"
508  + "Range is < 1.0 | 64 >."
509  ).ShaftWidth = (4, 1.0, 64, 1)
510  else:
511  fp.ShaftWidth = (fp.ShaftWidth, 1.0, 64, 1)
512  if not hasattr(fp, "ShowFrameLabels"):
513  fp.addProperty("App::PropertyBool", "ShowFrameLabels",
514  "Frame", "Show label for frame axes."
515  ).ShowFrameLabels = True
516 
517  # Rotation axis properties
518  if not hasattr(fp, "ShowRotationAxis"):
519  fp.addProperty("App::PropertyBool", "ShowRotationAxis",
520  "RotationAxis",
521  "Show currently used rotation axis."
522  ).ShowRotationAxis = True
523  if not hasattr(fp, "AxisLength"):
524  fp.addProperty("App::PropertyFloatConstraint", "AxisLength",
525  "RotationAxis", "The rotation axis length.\n"
526  + "Range is < 1.0 | 1e6 >."
527  ).AxisLength = (20, 1.0, 1e6, 1)
528  else:
529  fp.AxisLength = (fp.AxisLength, 1.0, 1e6, 1)
530  if not hasattr(fp, "AxisWidth"):
531  fp.addProperty("App::PropertyFloatConstraint", "AxisWidth",
532  "RotationAxis", "The rotation axis width.\n"
533  + "Range is < 1.0 | 64 >."
534  ).AxisWidth = (4, 1.0, 64, 1)
535  else:
536  fp.AxisWidth = (fp.AxisWidth, 1.0, 64, 1)
537  if not hasattr(fp, "AxisColor"):
538  fp.addProperty("App::PropertyColor", "AxisColor",
539  "RotationAxis", "The rotation axis width."
540  ).AxisColor = (1.000, 0.667, 0.000)
541  if not hasattr(fp, "AxisTransparency"):
542  fp.addProperty("App::PropertyPercent", "AxisTransparency",
543  "RotationAxis",
544  "Transparency of the rotation axis in percents."
545  ).AxisTransparency = 0
546  if not hasattr(fp, "ShowAxisArrowhead"):
547  fp.addProperty("App::PropertyBool", "ShowAxisArrowhead",
548  "RotationAxis", "Show arrowhead for axis arrow."
549  ).ShowAxisArrowhead = True
550  if not hasattr(fp, "AxisArrowheadLength"):
551  fp.addProperty("App::PropertyFloatConstraint",
552  "AxisArrowheadLength", "RotationAxis",
553  "Frame axis arrow's arrowhead length.\n"
554  + "Range is < 1.0 | 1e6 >."
555  ).AxisArrowheadLength = (10, 1.0, 1e6, 1)
556  else:
557  fp.AxisArrowheadLength = (fp.AxisArrowheadLength, 1.0, 1e6, 1)
558  if not hasattr(fp, "AxisArrowheadRadius"):
559  fp.addProperty("App::PropertyFloatConstraint",
560  "AxisArrowheadRadius", "RotationAxis",
561  "Frame axis arrow's arrowhead bottom radius.\n"
562  + "Range is < 0.5 | 1e6 >."
563  ).AxisArrowheadRadius = (5, 0.5, 1e6, 0.5)
564  else:
565  fp.AxisArrowheadRadius = (fp.AxisArrowheadRadius, 0.5, 1e6, 0.5)
566  if not hasattr(fp, "ShowAxisLabel"):
567  fp.addProperty("App::PropertyBool", "ShowAxisLabel",
568  "RotationAxis", "Show label for rotation axis."
569  ).ShowAxisLabel = True
570 
571  # Label properties
572  if not hasattr(fp, "FontSize"):
573  fp.addProperty("App::PropertyIntegerConstraint", "FontSize",
574  "Labels", "Label font size.\n"
575  + "Range is < 1 | 100 >."
576  ).FontSize = (10, 1, 100, 1)
577  else:
578  fp.FontSize = (fp.FontSize, 1, 100, 1)
579  if not hasattr(fp, "DistanceToAxis"):
580  fp.addProperty("App::PropertyFloatConstraint", "DistanceToAxis",
581  "Labels", "Distance from label to its axis.\n"
582  + "Range is < 0.5 | 1e6 >."
583  ).DistanceToAxis = (5, 0.5, 1e6, 0.5)
584  else:
585  fp.DistanceToAxis = (fp.DistanceToAxis, 0.5, 1e6, 0.5)
586  if not hasattr(fp, "Subscription"):
587  fp.addProperty("App::PropertyString", "Subscription", "Labels",
588  "Subscription added to an axis name."
589  ).Subscription = ""
590  if not hasattr(fp, "Superscription"):
591  fp.addProperty("App::PropertyString", "Superscription", "Labels",
592  "Superscription added to an axis name."
593  ).Superscription = ""
594  if not hasattr(fp, "FontFamily"):
595  fp.addProperty("App::PropertyEnumeration", "FontFamily",
596  "Labels", "Label font family."
597  ).FontFamily = ["SERIF", "SANS", "TYPEWRITER"]
598  if not hasattr(fp, "FontStyle"):
599  fp.addProperty("App::PropertyEnumeration", "FontStyle",
600  "Labels", "Label font style."
601  ).FontStyle = ["NONE", "BOLD", "ITALIC",
602  "BOLD ITALIC"]
603 
604  # Placement properties
605  if not hasattr(fp, "Placement"):
606  fp.addProperty("App::PropertyPlacement", "Placement", "Base",
607  "Current placement for animated objects in "
608  + "world frame.")
609 
610  # Make some properties read-only
611  fp.setEditorMode("ObjectPlacement", 1)
612  fp.setEditorMode("ParentFramePlacement", 1)
613 
614  # Hide some properties
615  fp.setEditorMode("Placement", 2)
616  fp.setEditorMode("ValidTrajectory", 2)
617 
618  import AnimateDocumentObserver
620 
def addObserver()
Adds an AnimateDocumentObserver between FreeCAD's document observers safely.

Member Data Documentation

◆ pose

Trajectory.TrajectoryProxy.pose

A dict describing a pose - position, rotation axis, point and angle.

Definition at line 386 of file Trajectory.py.


The documentation for this class was generated from the following file: