Rename: The two visual modes of using Sketcher

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!
freedman
Posts: 1732
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Rename: The two visual modes of using Sketcher

Postby freedman » Sun Nov 08, 2020 8:24 pm

I'm having a tough time searching for how to make a standard toolbar, like one that could be put in Master at some point. Is there a template or some sample code? I search and most all I get is how to install or modify in the program. Just doing a little research.
Thank you
Last edited by freedman on Sun Nov 15, 2020 6:27 am, edited 1 time in total.
openBrain
Posts: 5172
Joined: Fri Nov 09, 2018 5:38 pm

Re: How to make a standard toolbar

Postby openBrain » Sun Nov 08, 2020 8:53 pm

Are you looking for Python or C++?
freedman
Posts: 1732
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: How to make a standard toolbar

Postby freedman » Sun Nov 08, 2020 9:34 pm

Python. My thoughts were to get everything working in a macro then let you folks review and tear it up, to get it right. :) and then migrate to a toolbar. I would expect to build some icons (again for review), I don't know how this all packages but I would hope to get 95% of the work finished and then someone can try to integrate. I don't see me compiling FreeCAD currently.
Thanks
User avatar
johnwang
Posts: 578
Joined: Sun Jan 27, 2019 12:41 am

Re: How to make a standard toolbar

Postby johnwang » Mon Nov 09, 2020 1:30 am

You could try to download my test workbench. https://forum.freecadweb.org/viewtopic.php?f=40&t=44893

Just unzip under yourFreeCAD/mod folder. Start FreeCAD, switch to that hpBox workbench. You could add your code on it.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
mario52
Posts: 3308
Joined: Wed May 16, 2012 2:13 pm

Re: How to make a standard toolbar

Postby mario52 » Mon Nov 09, 2020 12:33 pm

hi

also here (macro) cube menu addon, please with icon include in macro

Image

or Customize_Toolbars

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
freedman
Posts: 1732
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: How to make a standard toolbar

Postby freedman » Tue Nov 10, 2020 5:14 am

Thanks all. That should do it.
Here is my target, I put together a 5 minute quick pic so you get the idea.

The first icon associates directly with (on v0.19) the setting Edit-Preferences-Sketcher-Display-Check box "Hide all objects that depend on the sketch". The button is a toggle SM1-SM2, SM2-SM1, the text stands for Sketch Mode 1 and 2. The button when set to SM2 needs to set the check box and set the option "Apply to existing sketches".
I don't know how to apply "Apply to existing sketches" in code, I don't know if it's ever been done.

The next three buttons set the global visibility (all objects) to the shown transparency.

I will do a following post showing why I think this setting is one of the most important changes FreeCAD can make.

Obviously the SM1-SM2 could turn into a series, SM3,SM4......
Thanks
Attachments
sketch_icon.png
sketch_icon.png (10.11 KiB) Viewed 379 times
drmacro
Posts: 2339
Joined: Sun Mar 02, 2014 4:35 pm

Re: How to make a standard toolbar

Postby drmacro » Tue Nov 10, 2020 11:02 am

hmm...I'm on a tablet at the moment, so can't check. But, I seem to remember someone else offering a macro or menu to do the transparency thing.

and "one of the most important changes"...count me as dubious 8-) but I look forward to you explanation.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."

My beginners, written treatise: Learning FreeCAD
mario52
Posts: 3308
Joined: Wed May 16, 2012 2:13 pm

Re: How to make a standard toolbar

Postby mario52 » Wed Nov 11, 2020 7:23 pm

hi

@ freedman i adapt my macro try this
Visibility_ToolBar.zip
(6.21 KiB) Downloaded 6 times
Visibility_ToolBar00.png
Visibility_ToolBar00.png (16.21 KiB) Viewed 283 times

you must modify the values in the Edit parameter after the first use

Code: Select all

User parameter:BaseApp/Preferences/Macros/FCMmacros/Visibility_ToolBar
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
freedman
Posts: 1732
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: How to make a standard toolbar

Postby freedman » Thu Nov 12, 2020 2:11 am

Geez, thanks Mario52. Very helpful...

The reason behind the toolbar follows in the pics. Each pic shows Sketch mode 1 (SM1) on the left and Sketch mode 2 (SM2) on the right.

Just about every time I get a file off the forum I convert the file to SM2 format, it allows me to see where the sketches are placed relative to the model. Also, I have been using SM2 for about 2 years, I get to design and see the entire model.
The problom with SM2 is the fact that you can't see sketches imbeded in the model so most everyone uses (SM1), the FreeCAD default. If we can change the global transparency easily then we all can start using SM2.

I think it's easy to see that SM2 is a better format for modeling.

To refresh what SM1, SM2 look like (in 0.19).
SM1 = Edit-Preferences-Sketcher-Display-Check box "Hide all objects that depend on the sketch" is checked.
SM2 = Edit-Preferences-Sketcher-Display-Check box "Hide all objects that depend on the sketch" is unchecked.
You will need to "Apply to existing sketch".
Attachments
SM1_SM2_sketch.png
SM1_SM2_sketch.png (275.85 KiB) Viewed 178 times
SM1_SM2_sketch1.png
SM1_SM2_sketch1.png (193.43 KiB) Viewed 178 times
SM1_SM2_sketch2.png
SM1_SM2_sketch2.png (210.69 KiB) Viewed 244 times
SM1_SM2_sketch3.png
SM1_SM2_sketch3.png (215.66 KiB) Viewed 244 times
SM1_SM2_sketch4.png
SM1_SM2_sketch4.png (188.28 KiB) Viewed 244 times
Last edited by freedman on Fri Nov 13, 2020 7:31 pm, edited 3 times in total.
freedman
Posts: 1732
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: How to make a standard toolbar

Postby freedman » Thu Nov 12, 2020 2:13 am

Here is the model file for the previous post, the file got too big.
Attachments
Test_arch_block.FCStd
(206.05 KiB) Downloaded 2 times