@@ -595,39 +595,43 @@ def modifyIndividualObjectTrajectory():
595595
596596
597597def updateTrajectoryLines ():
598- # this is disabled because is no longer accurate and needs conversion to new placement
599- return
600- EAFolder = FreeCAD .ActiveDocument .ExplodedAssembly .Group
601- # remove all the previous trajectory lines
602- for traj in EAFolder :
603- for lines in traj .Group :
604- FreeCAD .ActiveDocument .removeObject (lines .Name )
605-
606- # re-draw all trajectories
607- for traj in EAFolder :
608- lines_compound = []
609- objects = []
610- for name in traj .names :
611- objects .append (FreeCAD .ActiveDocument .getObject (name ))
612-
613- inc_D = traj .Distance
614- dir_vectors = []
615- rot_centers = []
616- for s in range (len (objects )):
617- dir_vectors .append (FreeCAD .Vector (tuple (traj .dir_vectors [s ])))
618- rot_centers .append (FreeCAD .Vector (tuple (traj .rot_centers [s ])))
619-
620- for n in range (len (objects )):
621- pa = rot_centers [n ]# objects[n].Placement.Base
622- pb = rot_centers [n ] + dir_vectors [n ]* inc_D
623- lines_compound .append (Part .makeLine (pa , pb ))
598+ # TODO this is disabled because is no longer accurate and needs conversion to new placement
599+ # goes to a try/except until solved
600+ #return
601+ try :
602+ EAFolder = FreeCAD .ActiveDocument .ExplodedAssembly .Group
603+ # remove all the previous trajectory lines
604+ for traj in EAFolder :
605+ for lines in traj .Group :
606+ FreeCAD .ActiveDocument .removeObject (lines .Name )
607+
608+ # re-draw all trajectories
609+ for traj in EAFolder :
610+ lines_compound = []
611+ objects = []
612+ for name in traj .names :
613+ objects .append (FreeCAD .ActiveDocument .getObject (name ))
624614
625- l_obj = FreeCAD .ActiveDocument .addObject ('Part::Feature' ,'trajectory_line' )
626- l_obj .Shape = Part .makeCompound (lines_compound )
627- l_obj .ViewObject .DrawStyle = "Dashed"
628- l_obj .ViewObject .LineWidth = 1.0
629- traj .addObject (l_obj )
615+ inc_D = traj .Distance
616+ dir_vectors = []
617+ rot_centers = []
618+ for s in range (len (objects )):
619+ dir_vectors .append (FreeCAD .Vector (tuple (traj .dir_vectors [s ])))
620+ rot_centers .append (FreeCAD .Vector (tuple (traj .rot_centers [s ])))
630621
622+ for n in range (len (objects )):
623+ pa = rot_centers [n ]# objects[n].Placement.Base
624+ pb = rot_centers [n ] + dir_vectors [n ]* inc_D
625+ lines_compound .append (Part .makeLine (pa , pb ))
626+
627+ l_obj = FreeCAD .ActiveDocument .addObject ('Part::Feature' ,'trajectory_line' )
628+ l_obj .Shape = Part .makeCompound (lines_compound )
629+ l_obj .ViewObject .DrawStyle = "Dashed"
630+ l_obj .ViewObject .LineWidth = 1.0
631+ traj .addObject (l_obj )
632+ except Exception as e :
633+ print ("Trajectory Line exception:" ,e )
634+
631635 FreeCAD .Gui .updateGui ()
632636
633637
0 commit comments