Building a toolbar that needs to change Preferences

Need help, or want to share a macro? Post here!
freedman
Posts: 1732
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Building a toolbar that needs to change Preferences

Postby freedman » Fri Nov 13, 2020 9:02 pm

Continuing from this link.
https://forum.freecadweb.org/viewtopic. ... 82#p447682

I'm try to change the preferences "Hide all objects that depend on the sketch" and then activate the button below "Apply to existing sketches". Having some trouble. I will post more later, just wanted to start a new post here.
Attachments
prefs_pic.PNG
prefs_pic.PNG (11.46 KiB) Viewed 202 times
freedman
Posts: 1732
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Building a toolbar that needs to change Preferences

Postby freedman » Sun Nov 15, 2020 6:24 am

Mario52, I posted a new macro in Help section for folks to try. The code worked perfect and it works great. I will start to look at your toolbar code, thanks.

I renamed the post to: "Rename: The two visual modes of using Sketcher"


Code: Select all

HideD_mode =  True
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Sketcher/General").SetBool("HideDependent",HideD_mode)
    for name,doc in App.listDocuments().items():
        for sketch in doc.findObjects('Sketcher::SketchObject'):
            sketch.ViewObject.HideDependent = HideD_mode