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

Rename: The two visual modes of using Sketcher

Post by freedman »

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
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: How to make a standard toolbar

Post by openBrain »

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

Re: How to make a standard toolbar

Post by freedman »

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
Veteran
Posts: 1382
Joined: Sun Jan 27, 2019 12:41 am

Re: How to make a standard toolbar

Post by johnwang »

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
Veteran
Posts: 4690
Joined: Wed May 16, 2012 2:13 pm

Re: How to make a standard toolbar

Post by mario52 »

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.
My macros on Gist.github here complete macros Wiki and forum.
freedman
Veteran
Posts: 3464
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: How to make a standard toolbar

Post by freedman »

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 1372 times
drmacro
Veteran
Posts: 8978
Joined: Sun Mar 02, 2014 4:35 pm

Re: How to make a standard toolbar

Post by drmacro »

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."
mario52
Veteran
Posts: 4690
Joined: Wed May 16, 2012 2:13 pm

Re: How to make a standard toolbar

Post by mario52 »

hi

@ freedman i adapt my macro try this
Visibility_ToolBar.zip
(6.21 KiB) Downloaded 24 times
Visibility_ToolBar00.png
Visibility_ToolBar00.png (16.21 KiB) Viewed 1276 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.
My macros on Gist.github here complete macros Wiki and forum.
freedman
Veteran
Posts: 3464
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: How to make a standard toolbar

Post by freedman »

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 1171 times
SM1_SM2_sketch1.png
SM1_SM2_sketch1.png (193.43 KiB) Viewed 1171 times
SM1_SM2_sketch2.png
SM1_SM2_sketch2.png (210.69 KiB) Viewed 1237 times
SM1_SM2_sketch3.png
SM1_SM2_sketch3.png (215.66 KiB) Viewed 1237 times
SM1_SM2_sketch4.png
SM1_SM2_sketch4.png (188.28 KiB) Viewed 1237 times
Last edited by freedman on Sun Mar 13, 2022 7:29 am, edited 4 times in total.
freedman
Veteran
Posts: 3464
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: How to make a standard toolbar

Post by freedman »

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