Hi Werner,
I'm trying to create a timed sequence of presenting a 3D model using python code...
I've used for the example a simple code generated in the report panel doing some very simple operations.
If I put the code in a macro and execute it (i.e. from the Toolbar) I get simply the last operation displayed on Linux and some step on win, and the last view...
I tried to add some sleep(1) op to obtain a timed sequence but it simply hangs until displaying the last operation result...
Code: Select all
import time
Gui.runCommand('Std_Workbench',11)
Gui.runCommand('Std_ViewStatusBar',1)
### Begin command Std_New
App.newDocument("Unnamed")
# App.setActiveDocument("Unnamed")
# App.ActiveDocument=App.getDocument("Unnamed")
# Gui.ActiveDocument=Gui.getDocument("Unnamed")
Gui.activeDocument().activeView().viewDefaultOrientation()
### End command Std_New
Gui.runCommand('Std_OrthographicCamera',1)
### Begin command Part_Box
App.ActiveDocument.addObject("Part::Box","Box")
App.ActiveDocument.ActiveObject.Label = "Cube"
App.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")
### End command Part_Box
# Gui.Selection.addSelection('Unnamed','Box')
### Begin command Std_RandomColor
Gui.getDocument('Unnamed').getObject('Box').ShapeColor=(0.61,0.96,0.07)
time.sleep(1)
### End command Std_RandomColor
### Begin command Part_Cylinder
App.ActiveDocument.addObject("Part::Cylinder","Cylinder")
App.ActiveDocument.ActiveObject.Label = "Cylinder"
App.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")
### End command Part_Cylinder
# Gui.Selection.clearSelection()
# Gui.Selection.addSelection('Unnamed','Cylinder')
### Begin command Std_RandomColor
Gui.getDocument('Unnamed').getObject('Cylinder').ShapeColor=(0.88,0.65,0.32)
time.sleep(1)
### End command Std_RandomColor
FreeCAD.getDocument('Unnamed').getObject('Cylinder').Placement = App.Placement(App.Vector(0,0,5),App.Rotation(App.Vector(0,0,1),0))
time.sleep(1)
# Gui.Selection.clearSelection()
### Begin command Std_ViewIsometric
Gui.activeDocument().activeView().viewIsometric()
### End command Std_ViewIsometric
time.sleep(1)
FreeCAD.getDocument('Unnamed').getObject('Box').Placement = App.Placement(App.Vector(0,0,0),App.Rotation(App.Vector(0,0,1),45))
# Gui.Selection.clearSelection()
# Gui.Selection.addSelection('Unnamed','Box')
FreeCADGui.getDocument('Unnamed').getObject('Box').Transparency = 50
time.sleep(1)
# Gui.Selection.clearSelection()
# Gui.Selection.addSelection('Unnamed','Cylinder')
FreeCADGui.getDocument('Unnamed').getObject('Cylinder').Transparency = 70
# Gui.Selection.clearSelection()
Is there a way to create a timed sequence of 3D operation or we would need to create a macro that reads and plays timed some code snippets?