Hi all,
I'd like to put together an animation, and I would really like to use python. I have a very good reason for that. I've been trying to find a decent description on how to work with the camera, but I seem to come up against hard walls here. While there is scattered information on the subject, the problem is exactly that, that is scattered. I know how to move objects around, I have difficulties with the camera only.
My question is really simple: what do I need to do, if I want to set the camera to position (x, y, z), I want it to look at position (x0, y0, z0), or I want it to have an orientation (the top of its field of view) pointing to (x1, y1, z1), and I want it to have an aperture of phi degrees.
I would be more than happy to work on the documentation, if someone points me in the right direction.
Many thanks,
Zoltán
camera scripting
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: camera scripting
Have a look at the code of the FCCamera addon macro.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: camera scripting
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: camera scripting
Thanks, Chris! This is indeed useful.
Re: camera scripting
Fantastic, thanks! The reason I wanted to use python is that I need to add dynamic text to the scenes.mario52 wrote: ↑Sun Mar 19, 2023 9:56 pm camera animation Vila Matilde House, working with linked files
Last edited by zvoros on Sun Mar 19, 2023 11:09 pm, edited 1 time in total.
Re: camera scripting
Hi
Thanks chrisb
@zvoros other
Programmatically setting the center of rotation
Set camera position by script
COIN3D_Snippet
search.php?st=0&sk=t&sd=d&sr=posts&keyw ... f&start=10
reading
mario
Thanks chrisb
@zvoros other
Programmatically setting the center of rotation
Set camera position by script
COIN3D_Snippet
search.php?st=0&sk=t&sd=d&sr=posts&keyw ... f&start=10
Code: Select all
print(Gui.ActiveDocument.ActiveView.getCamera())
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.