From b094a0231a621ba87c41c47ae156eb592f7122cd Mon Sep 17 00:00:00 2001 From: Francisco Date: Fri, 9 Dec 2022 17:44:39 -0300 Subject: [PATCH 1/7] Inclusion to trigger recording toolbar --- ExplodedAssembly.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/ExplodedAssembly.py b/ExplodedAssembly.py index 5058d70..96a90a8 100644 --- a/ExplodedAssembly.py +++ b/ExplodedAssembly.py @@ -27,7 +27,7 @@ import time import FreeCAD import Part - +import RecordPlayVideo as rpv # Inclusion to trigger recording # Container python folder 'ExplodedAssembly' class ExplodedAssemblyFolder: @@ -360,6 +360,15 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): traj = EAFolder[r] # set current stop point EA.CurrentTrajectory = r-1 + + + # Inclusion to trigger recording + if 'Clapperboard' in FreeCAD.ActiveDocument.Content: + CL = FreeCAD.ActiveDocument.Clapperboard + if CL.Cam_3OnRec == True: + rpv.runRecordCamera() + # End of inclusion + # highligh current trajectory FreeCAD.Gui.Selection.addSelection(traj) @@ -395,6 +404,16 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): obj.Placement = incremental_placement.multiply(obj.Placement) FreeCAD.Gui.updateGui() + + + # Inclusion to trigger recording + if 'Clapperboard' in FreeCAD.ActiveDocument.Content: + CL = FreeCAD.ActiveDocument.Clapperboard + if CL.Cam_3OnRec == True: + rpv.runRecordCamera() + # End of inclusion + + time.sleep(traj.AnimationStepTime) else: @@ -432,6 +451,15 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): EA = FreeCAD.ActiveDocument.ExplodedAssembly # toggle InAnimation to activate icons deactivated before EA.InAnimation = False + + + # Inclusion to reset recording + if 'Clapperboard' in FreeCAD.ActiveDocument.Content: + CL = FreeCAD.ActiveDocument.Clapperboard + CL.Cam_3OnRec = False + # End of inclusion + + # set CurrentTrajectory number if not(animation_paused): if direction == 'forward' and end == 0: From e9a07ba58ffe7cd22a4ad45a1bd24db272273a3e Mon Sep 17 00:00:00 2001 From: Francisco Date: Mon, 12 Dec 2022 21:56:17 -0300 Subject: [PATCH 2/7] Added connection with Movie Workbench --- ExplodedAssembly.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ExplodedAssembly.py b/ExplodedAssembly.py index 96a90a8..3028abf 100644 --- a/ExplodedAssembly.py +++ b/ExplodedAssembly.py @@ -349,6 +349,12 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): EA = FreeCAD.ActiveDocument.ExplodedAssembly if not(EA.InAnimation): animation_paused = True + + # Inclusion to reset recording + if 'Clapperboard' in FreeCAD.ActiveDocument.Content: + rpv.stopRecordCamera() + # End of inclusion + break if direction == 'forward': @@ -361,14 +367,12 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): # set current stop point EA.CurrentTrajectory = r-1 - # Inclusion to trigger recording if 'Clapperboard' in FreeCAD.ActiveDocument.Content: CL = FreeCAD.ActiveDocument.Clapperboard if CL.Cam_3OnRec == True: rpv.runRecordCamera() # End of inclusion - # highligh current trajectory FreeCAD.Gui.Selection.addSelection(traj) @@ -404,15 +408,13 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): obj.Placement = incremental_placement.multiply(obj.Placement) FreeCAD.Gui.updateGui() - # Inclusion to trigger recording if 'Clapperboard' in FreeCAD.ActiveDocument.Content: CL = FreeCAD.ActiveDocument.Clapperboard if CL.Cam_3OnRec == True: rpv.runRecordCamera() - # End of inclusion - + # End of inclusion time.sleep(traj.AnimationStepTime) @@ -451,14 +453,11 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): EA = FreeCAD.ActiveDocument.ExplodedAssembly # toggle InAnimation to activate icons deactivated before EA.InAnimation = False - # Inclusion to reset recording if 'Clapperboard' in FreeCAD.ActiveDocument.Content: - CL = FreeCAD.ActiveDocument.Clapperboard - CL.Cam_3OnRec = False - # End of inclusion - + rpv.stopRecordCamera() + # End of inclusion # set CurrentTrajectory number if not(animation_paused): From 5b8452c02e829c99f7041e7871b6cd6ba516c068 Mon Sep 17 00:00:00 2001 From: F_Rosa Date: Wed, 21 Dec 2022 18:52:31 -0300 Subject: [PATCH 3/7] Upadte importing the Movie Workbench Correct the position of importing the Movie Workbench --- ExplodedAssembly.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ExplodedAssembly.py b/ExplodedAssembly.py index 3028abf..a88c453 100644 --- a/ExplodedAssembly.py +++ b/ExplodedAssembly.py @@ -27,7 +27,6 @@ import time import FreeCAD import Part -import RecordPlayVideo as rpv # Inclusion to trigger recording # Container python folder 'ExplodedAssembly' class ExplodedAssemblyFolder: @@ -344,6 +343,12 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): traj_iterator = range(number_of_trajectories-1, -1, -1) animation_paused = False + + # Inclusion to import the Movie module only if it already exists a Clapperboard + if 'Clapperboard' in FreeCAD.ActiveDocument.Content: + import RecordPlayVideo as rpv + # End of inclusion + for r in traj_iterator: # break animation loop if not InAnimation (this is where pause animation takes place): EA = FreeCAD.ActiveDocument.ExplodedAssembly @@ -367,7 +372,7 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): # set current stop point EA.CurrentTrajectory = r-1 - # Inclusion to trigger recording + # Inclusion to trigger recording the first frame if 'Clapperboard' in FreeCAD.ActiveDocument.Content: CL = FreeCAD.ActiveDocument.Clapperboard if CL.Cam_3OnRec == True: @@ -409,7 +414,7 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): FreeCAD.Gui.updateGui() - # Inclusion to trigger recording + # Inclusion to trigger recording frames if 'Clapperboard' in FreeCAD.ActiveDocument.Content: CL = FreeCAD.ActiveDocument.Clapperboard if CL.Cam_3OnRec == True: From 650c6e70dce42fb97407b7126f815cc4e7a5532e Mon Sep 17 00:00:00 2001 From: F_Rosa Date: Wed, 21 Dec 2022 18:58:36 -0300 Subject: [PATCH 4/7] Inclusions to import Movie Workbench Simple corrections --- ExplodedAssembly.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ExplodedAssembly.py b/ExplodedAssembly.py index a88c453..4d40208 100644 --- a/ExplodedAssembly.py +++ b/ExplodedAssembly.py @@ -372,7 +372,7 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): # set current stop point EA.CurrentTrajectory = r-1 - # Inclusion to trigger recording the first frame + # Inclusion to trigger the first frame recording if 'Clapperboard' in FreeCAD.ActiveDocument.Content: CL = FreeCAD.ActiveDocument.Clapperboard if CL.Cam_3OnRec == True: From b2644a7410e6adf2cf732b1fbb8bdc29c419b1d4 Mon Sep 17 00:00:00 2001 From: F_Rosa Date: Wed, 15 Feb 2023 14:34:53 -0300 Subject: [PATCH 5/7] Camera connection included --- ExplodedAssembly.py | 50 +++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/ExplodedAssembly.py b/ExplodedAssembly.py index 4d40208..c6e9e28 100644 --- a/ExplodedAssembly.py +++ b/ExplodedAssembly.py @@ -344,22 +344,19 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): animation_paused = False - # Inclusion to import the Movie module only if it already exists a Clapperboard - if 'Clapperboard' in FreeCAD.ActiveDocument.Content: - import RecordPlayVideo as rpv - # End of inclusion + # Inclusion to import the Connection module + if 'MovieCamera' in FreeCAD.ActiveDocument.Content: + import Connection as co + MC_presence = True + else: + MC_presence = False + # End of inclusion for r in traj_iterator: # break animation loop if not InAnimation (this is where pause animation takes place): EA = FreeCAD.ActiveDocument.ExplodedAssembly if not(EA.InAnimation): - animation_paused = True - - # Inclusion to reset recording - if 'Clapperboard' in FreeCAD.ActiveDocument.Content: - rpv.stopRecordCamera() - # End of inclusion - + animation_paused = True break if direction == 'forward': @@ -371,14 +368,7 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): traj = EAFolder[r] # set current stop point EA.CurrentTrajectory = r-1 - - # Inclusion to trigger the first frame recording - if 'Clapperboard' in FreeCAD.ActiveDocument.Content: - CL = FreeCAD.ActiveDocument.Clapperboard - if CL.Cam_3OnRec == True: - rpv.runRecordCamera() - # End of inclusion - + # highligh current trajectory FreeCAD.Gui.Selection.addSelection(traj) # If trajectory is a bolt group or simple group: @@ -412,14 +402,13 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): incremental_placement = FreeCAD.Placement(obj_base, obj_rot, obj_rot_center) obj.Placement = incremental_placement.multiply(obj.Placement) - FreeCAD.Gui.updateGui() - - # Inclusion to trigger recording frames - if 'Clapperboard' in FreeCAD.ActiveDocument.Content: - CL = FreeCAD.ActiveDocument.Clapperboard - if CL.Cam_3OnRec == True: - rpv.runRecordCamera() - # End of inclusion + + # Inclusion to connects with Movie Camera module + if MC_presence == True: + co.connectionEA() + # End of inclusion + + FreeCAD.Gui.updateGui() time.sleep(traj.AnimationStepTime) @@ -457,12 +446,7 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): # set pointer to current trajectory index EA = FreeCAD.ActiveDocument.ExplodedAssembly # toggle InAnimation to activate icons deactivated before - EA.InAnimation = False - - # Inclusion to reset recording - if 'Clapperboard' in FreeCAD.ActiveDocument.Content: - rpv.stopRecordCamera() - # End of inclusion + EA.InAnimation = False # set CurrentTrajectory number if not(animation_paused): From 9747c1154d55e96eaa736dc68cd126ca3fbc1e44 Mon Sep 17 00:00:00 2001 From: F_Rosa Date: Sat, 18 Feb 2023 11:05:48 -0300 Subject: [PATCH 6/7] Add files via upload --- ExplodedAssembly.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ExplodedAssembly.py b/ExplodedAssembly.py index c6e9e28..55ca03e 100644 --- a/ExplodedAssembly.py +++ b/ExplodedAssembly.py @@ -28,6 +28,7 @@ import FreeCAD import Part + # Container python folder 'ExplodedAssembly' class ExplodedAssemblyFolder: def __init__(self, obj): @@ -350,13 +351,13 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): MC_presence = True else: MC_presence = False - # End of inclusion + # End of inclusion for r in traj_iterator: # break animation loop if not InAnimation (this is where pause animation takes place): EA = FreeCAD.ActiveDocument.ExplodedAssembly if not(EA.InAnimation): - animation_paused = True + animation_paused = True break if direction == 'forward': @@ -368,7 +369,7 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): traj = EAFolder[r] # set current stop point EA.CurrentTrajectory = r-1 - + # highligh current trajectory FreeCAD.Gui.Selection.addSelection(traj) # If trajectory is a bolt group or simple group: @@ -406,10 +407,9 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): # Inclusion to connects with Movie Camera module if MC_presence == True: co.connectionEA() - # End of inclusion - - FreeCAD.Gui.updateGui() - + # End of inclusion + + FreeCAD.Gui.updateGui() time.sleep(traj.AnimationStepTime) else: @@ -446,8 +446,7 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): # set pointer to current trajectory index EA = FreeCAD.ActiveDocument.ExplodedAssembly # toggle InAnimation to activate icons deactivated before - EA.InAnimation = False - + EA.InAnimation = False # set CurrentTrajectory number if not(animation_paused): if direction == 'forward' and end == 0: From 892c8d472a49a3ec9a1b6c6e17d25fa15ab11cd2 Mon Sep 17 00:00:00 2001 From: F_Rosa Date: Sat, 10 Jun 2023 18:19:44 -0300 Subject: [PATCH 7/7] Add files via upload --- ExplodedAssembly.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/ExplodedAssembly.py b/ExplodedAssembly.py index 55ca03e..c7ee9e0 100644 --- a/ExplodedAssembly.py +++ b/ExplodedAssembly.py @@ -319,7 +319,15 @@ def resetPlacement(): rot = FreeCAD.Rotation(plm[1][0], plm[1][1], plm[1][2], plm[1][3]) obj.Placement = FreeCAD.Placement(base, rot) - +# Inclusion to import the Connection module +MC_CONNECTION = False +def connectionMC(option = False): + global MC_CONNECTION + if option == True: + MC_CONNECTION = True + else: + MC_CONNECTION = False +# End of inclusion def runAnimation(start=0, end=0, mode='complete', direction='forward'): # runs the animation from a start step number to the end step number @@ -344,15 +352,7 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): traj_iterator = range(number_of_trajectories-1, -1, -1) animation_paused = False - - # Inclusion to import the Connection module - if 'MovieCamera' in FreeCAD.ActiveDocument.Content: - import Connection as co - MC_presence = True - else: - MC_presence = False - # End of inclusion - + for r in traj_iterator: # break animation loop if not InAnimation (this is where pause animation takes place): EA = FreeCAD.ActiveDocument.ExplodedAssembly @@ -405,8 +405,9 @@ def runAnimation(start=0, end=0, mode='complete', direction='forward'): # Inclusion to connects with Movie Camera module - if MC_presence == True: - co.connectionEA() + if MC_CONNECTION == True: + import MovieConnection as co + co.connectionEA() # End of inclusion FreeCAD.Gui.updateGui()