[Solved] Save camera position

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
M4x
Veteran
Posts: 1474
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

[Solved] Save camera position

Post by M4x »

Hey everybody,

I'd like to save specific camera positions to be able to come back to exactly this view (distance from part, rotation and so on). I thought there was a macro for this. I've checked out Macro_FCCamera but that doesn't look like what I'm searchin for (or I haven't used it in the right way :roll: ).

Help is appreciated.

Code: Select all

OS: Ubuntu 20.04.3 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.25645 (Git) AppImage
Build type: Release
Branch: master
Hash: 37d9757399b4c2ec30318eb88d7cd7c508246345
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: English/United States (en_US)
Last edited by M4x on Sat Sep 25, 2021 6:37 pm, edited 1 time in total.
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Save camera position

Post by wmayer »

What about View > Freeze display > Freeze View?
User avatar
M4x
Veteran
Posts: 1474
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: Save camera position

Post by M4x »

Perfect, thanks! For the record: Std_FreezeViews

If there's a way to get the frozen views into the object tree, I'd like to hear about it too.
mario52
Veteran
Posts: 4674
Joined: Wed May 16, 2012 2:13 pm

Re: [Solved] Save camera position

Post by mario52 »

Hi
M4x wrote: Sat Sep 25, 2021 4:57 pm (or I haven't used it in the right way :roll: ).
no you use correctly but the macro not save the view
wmayer wrote: Sat Sep 25, 2021 6:32 pm What about View > Freeze display > Freeze View?
why not save the icon view:

FreezeViewIcon00.png
FreezeViewIcon00.png (8.61 KiB) Viewed 1801 times

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.
User avatar
M4x
Veteran
Posts: 1474
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: [Solved] Save camera position

Post by M4x »

How did you get those thumbnails? This is how it looks for me.

Peek 2021-09-25 22-04.gif
Peek 2021-09-25 22-04.gif (112.9 KiB) Viewed 1777 times
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Solved] Save camera position

Post by wmayer »

M4x wrote: Sat Sep 25, 2021 8:06 pm How did you get those thumbnails? This is how it looks for me
I think that's part of an add-on.
If there's a way to get the frozen views into the object tree, I'd like to hear about it too.
Not with standard functionality. But you can implement a custom Python feature and for its view provider you can implement e.g a context-menu where to get and set the camera settings.

The functions are:

Code: Select all

cam = Gui.ActiveDocument.ActiveView.getCamera()
# ...
Gui.ActiveDocument.ActiveView.setCamera(cam)
mario52
Veteran
Posts: 4674
Joined: Wed May 16, 2012 2:13 pm

Re: [Solved] Save camera position

Post by mario52 »

Hi
M4x wrote: Sat Sep 25, 2021 8:06 pm How did you get those thumbnails? This is how it looks for me.
sorry this is one montage with Gimp and one good suggestion

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.
User avatar
M4x
Veteran
Posts: 1474
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: [Solved] Save camera position

Post by M4x »

wmayer wrote: Sat Sep 25, 2021 8:40 pm [...]
But you can implement a custom Python feature and for its view provider you can implement e.g a context-menu where to get and set the camera settings.

The functions are:

Code: Select all

cam = Gui.ActiveDocument.ActiveView.getCamera()
# ...
Gui.ActiveDocument.ActiveView.setCamera(cam)
Thank you very much, looks interesting!

mario52 wrote: Sun Sep 26, 2021 5:34 pm [...]
sorry this is one montage with Gimp and one good suggestion
Thanks - there's no reason to apologize! Especially if this leads to further improvement :D
mario52
Veteran
Posts: 4674
Joined: Wed May 16, 2012 2:13 pm

Re: [Solved] Save camera position

Post by mario52 »

Hi

maybe one future macro ...

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.
User avatar
s-light
Posts: 119
Joined: Thu Feb 12, 2015 11:39 am
Location: Germany, Hofheim am Taunus
Contact:

Re: [Solved] Save camera position

Post by s-light »

just tried the *Pov saver* from
https://github.com/mnesarco/FreeCAD_Utils

its working fine- and just does what is asked for in this thread:
- save camera position
- available in the three view

if i had time :roll: i like to extract it to a stand-alone macro and tweak it a little bit:
- switch to view on double-click
- update view with button in context menu or toolbar
- create view with button in context menu or toolbar
- no *action dialog needed for me ;-)
- create *real* classes - so you now what type of object you are dealing with in scripting..
- add option in top group to export all selected views as screenshots

sunny greetings
stefan
Post Reply