Preferences Preset Macro

Need help, or want to share a macro? Post here!
User avatar
furti
Posts: 94
Joined: Mon Nov 27, 2017 5:27 pm

Preferences Preset Macro

Postby furti » Sun Sep 09, 2018 7:00 am

Hi,

FreeCAD has a powerful Preferences page and is really customizable. But when switching between different project types (e.g. working on a building and switching to a part object later on) you have to set the preferences (unit settings, draft grid, sketcher,...) back and forth to have to perfect environment for your task.

This happened to me in the past quite often. Don't know if others have the problem too. Googled around and searched the forum but could not find a solution for my problem. Maybe I used the wrong search terms or it simply does not exist :D

So i created a small Macro that can help to overcome this issue. https://github.com/furti/FreeCAD-PreferencesPresets
Maybe this can be of use for others too.

Basically the macro copies the "user.cfg" and "system.cfg" in your FreeCAD AppDataDir to another Location and creates a executable script file for you, that starts FreeCAD with the "--user-cfg" and "--system-cfg" flags. So you can have multiple executables that preload FreeCAD with the preferences you need for your current project type.

Best Regards
furti :)
User avatar
Kunda1
Posts: 3237
Joined: Thu Jan 05, 2017 9:03 pm

Re: Preferences Preset Macro

Postby Kunda1 » Sun Sep 09, 2018 12:11 pm

Coolness!
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
bernd
Posts: 6295
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Preferences Preset Macro

Postby bernd » Sun Sep 09, 2018 4:05 pm

btw related: is it possible to load different pref files at run time in FreeCAD.
User avatar
furti
Posts: 94
Joined: Mon Nov 27, 2017 5:27 pm

Re: Preferences Preset Macro

Postby furti » Sun Sep 09, 2018 4:45 pm

bernd wrote:
Sun Sep 09, 2018 4:05 pm
is it possible to load different pref files at run time in FreeCAD
Good question. I searched for it too but couldn't find anything to load the prefs via python. So i went for the approach with creating scripts to start freecad with the specific arguments.
User avatar
Kunda1
Posts: 3237
Joined: Thu Jan 05, 2017 9:03 pm

Re: Preferences Preset Macro

Postby Kunda1 » Fri Sep 14, 2018 1:12 pm

I have high hopes for this macro. Thanks for all your work on it @furti
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
furti
Posts: 94
Joined: Mon Nov 27, 2017 5:27 pm

Re: Preferences Preset Macro

Postby furti » Fri Sep 14, 2018 4:29 pm

Kunda1 wrote:
Fri Sep 14, 2018 1:12 pm
I have high hopes for this macro.
Good to hear that others make use of it too. :)

Want to add the option to merge options from one config into another. Maybe one has a answer for this question http://forum.freecadweb.org/viewtopic.php?t=30877

Hope it is ok to cross post here. But maybe one that finds the macro has a answer fr this :D
User avatar
furti
Posts: 94
Joined: Mon Nov 27, 2017 5:27 pm

Re: Preferences Preset Macro

Postby furti » Sat Sep 15, 2018 6:44 pm

Found another use case for the macro i hadn't thought of :D

When developing one might organize workbenches and macros into different directories. One directory for each worbench/macro. At least i found it best to treat commands i implement into my workbenches as macros and execute them from the Macro dialog. So i can test them until they work as expected, without restarting FreeCAD over and over again.
But to do so, i have to change the macro directory back and forth. When developing I have to set it to my repository location and when working on other stuff back to the default macro location.

Luckily FreeCAD stores the macro directory in the config Files. Now I can make a preset with the macro directory set to my repository location and have the default macro location for all other instances :)