If you wanted images to insert into a presentation application document, you could use screen capture and Tools menu...Save Picture.
You can also now (as of a few days ago, thanks Werner!) in FreeCAD 0.19, export to html5 webGL so that a 3d model can be viewed, rotated, zoomed etc. in any modern web browser.
Feature Request: FreeCAD for making presentations.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
Re: Feature Request: FreeCAD for making presentations.
Thank you very much for your answer.jmaustpc wrote: ↑Tue Sep 29, 2020 12:10 pm If you wanted images to insert into a presentation application document, you could use screen capture and Tools menu...Save Picture.
You can also now (as of a few days ago, thanks Werner!) in FreeCAD 0.19, export to html5 webGL so that a 3d model can be viewed, rotated, zoomed etc. in any modern web browser.
But it is not what I was requesting.
Thanks again.
I have uploaded many FreeCAD video tutorials to my YouTube channel
Re: Feature Request: FreeCAD for making presentations.
I tried to simply make some simple operations like toggle visibility of objects and change placement... these will generate some python code in the report panel.mfro wrote: ↑Mon Sep 28, 2020 6:47 pmIt should be possible to write such a playbook as macro with even minimal Python knowledge.jruiz wrote: ↑Sun Sep 27, 2020 3:13 pm...
What I think that could be a good feature for FreeCAD is that:
- One could select a set of these objects, and sorting a sequence we decide in order for this objects to be shown and/or hidden as we wish.
- Then after entering into presentation mode, with just (for example) a mouse click, the objects would be shown and/or hidden in the sequence configured in item 1.
The problem is that if I execute the code, everything is executed immediately, and the result is to show simply last operation result.
I tried to add some delay
Code: Select all
sleep(1)
So it seems to me that it is not possible ATM to create a simple timed presentation of a 3D operation sequence.
Suggestions would be most welcome.
Re: Feature Request: FreeCAD for making presentations.
Hi Werner,wmayer wrote:ping
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()
Re: Feature Request: FreeCAD for making presentations.
Adding a call of sleep() won't work because it blocks the event loop. In order to get an animated move between camera positions you should enable the animation of the view.
for more advanced things have a look at Qt's animation framework: https://doc.qt.io/qt-5/animation-overview.html
Code: Select all
view=Gui.ActiveDocument.ActiveView
view.setAnimationEnabled(True)
-
- Posts: 16
- Joined: Thu Mar 02, 2017 12:36 am
Re: Feature Request: FreeCAD for making presentations.
easyw-fc wrote: ↑Tue Oct 06, 2020 3:47 pmHi Werner,wmayer wrote:ping
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...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?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()
I'm sure there's a much better way, but here is a simple example that doesn't block the main thread:
Code: Select all
def toggle_vis(time_to_wait_secs, object_list):
for object_to_toggle in object_list:
object_vis_state = object_to_toggle.Visibility
new_object_vis_state = not object_vis_state
object_to_toggle.Visibility = new_object_vis_state #toggle
time.sleep(time_to_wait_secs)
object_to_toggle.Visibility = object_vis_state #toggle back
time.sleep(time_to_wait_secs)
time_to_wait_secs = 1
threading.Thread(target=toggle_vis, args=(time_to_wait_secs, object_list)).start()