New macro, Vision1, check it out

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
freedman
Veteran
Posts: 3466
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

New macro, Vision1, check it out

Post by freedman »

I will keep the updated version on this first post. If any updates are made then the latest version will be here.

Here is a description:
How to use Vision1:
The upper text states "Visible % all", that's short for Visibility % for all objects in the current model (or document as it's called in FreeCAD). The first thing to notice is that I didn't use transparency", I used visibility so 100% is a solid and 0 % is see-thru. The "all" means that when a level is clicked on the program changes the visibility of all bodies/objects. This feature is especially useful in sketcher, changing visibility is great for looking thru mating parts.
The next section reads "% pick toggle", the buttons below control percent of visibility for picks directly on the model object in the graphic screen. If the ON/OFF button is off then this feature is disabled, when turned on the toggle is enabled. The toggle uses two values for visibility control, one is the value set above in "visibility % all", the other is the setting for "% pick toggle". Every time you click on a model object the visibility will toggle between the two visibility values. So if the upper vis. is set to 100% and the lower is set to 0% and I click on an object twice, the object will change from solid to clear. You can select any number of items. One way to use this is to set the entire model to 10% all then selectively turn on objects at 90% pick by clicking on them. Remember, just because you can see thru an object doesn't mean FreeCAD can select it. Some items will need to be turn off using the space bar to select them. Pick has to be turned off to select a model face/line or to remove an object (space bar) from 3D view. Pick toggle is disabled in sketcher.

I see Vision1 as an efficiency tool, once you get used to it there are almost no wasted steps when moving from sketching to 3D design viewing.
Oh!, the left and right buttons move all the program buttons to left and right screen.

I think this brings a whole new level of viewing to FreeCAD, I have been using this for a few days now and I don't want to work without it. Hope you like it.

This macro currently only works on PartDesign, Part, Arch.

Let me know how the buttons look in other than Win7, win10.

Updated Vision1-1 to Vision1-2; Changed the button vertical size for other OS, I can't test this currently.
Update vision1, small percentage number issue, not reving
Thanks
Attachments
Vision3-1.FCMacro
(15.56 KiB) Downloaded 53 times
vision1 image.JPG
vision1 image.JPG (30.23 KiB) Viewed 2088 times
Last edited by freedman on Thu Nov 07, 2019 5:15 pm, edited 6 times in total.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: New macro, Vision1, check it out

Post by Kunda1 »

This looks amazing. Probably good to x-post with Glass WB since there may be a real usecase to incorporate this methodology there?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: New macro, Vision1, check it out

Post by openBrain »

Hi freedman,

Nice job. :) Below some feedback :
  • As you didn't manage the buttons size, here they are overlapping (picture 1). Why not use Qt things such a vertical spacers to ensure good layout ?
  • As my 2 screens have different resolutions, when I set it to "right" (in my case), I lose some buttons on the top of the screen (picture 2)
  • The buttons are always on top, even over other applications than FC. I don't like it much. :)
  • As the buttons are inside a QDialog, the macro appears as a FreeCAD window in the task bar. I don't like it much too. :)
  • As the QDialog extends on the complete vertical size of the screen, when its on the left, I can't no more access "File" menu or the "New document" icon. Again I don't like it much. :)
  • The headers (bold strings) are displayed into push buttons, which if I'm correct do nothing. I find it disturbing. Why not use QLabel instead ?
  • The objects are not reset to their default visibility when the macro is exited. IMO it should be done. ;)
To summarize, I think this is an interesting feature, but in my case, I'd definitely prefer to have it into a dockable widget rather than in an overlaying dialog.
pic1.png
pic1.png (12.6 KiB) Viewed 2057 times
pic2.png
pic2.png (10.12 KiB) Viewed 2057 times
HTH.

EDIT : forgot the pictures. ;) Also find my post looks rough, but please be sure I know the coding effort it is and appreciate it. ;)
freedman
Veteran
Posts: 3466
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: New macro, Vision1, check it out

Post by freedman »

I knew there would be many issues with the buttons. I'm new to Python and FreeCAD structure, I was running out of time to do this so to actually get something done I decided that if I saw something that worked use it. If I did otherwise I would probably never finish. :)

OpenBrain, I agree with just about everything on your list except for the last one. I don't know why there would be a default viewing. Anyway, what I wanted to do was make a tool for me and show a concept to the group, I use Appearance->transparency all the time and I wanted to show that it's use is under utilized. I have a list of things that I want also. :)

I'm working, building my house, learning Python, writing macros. Doing this cost me about 10 hours of sleep. :)
If the group likes this enough maybe there is support to fix stuff. I know I just don't have the time. If someone wants to correct all the issues then Jump in, I just don't feel it's my place to ask.
Last edited by freedman on Fri Jun 14, 2019 7:26 pm, edited 1 time in total.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: New macro, Vision1, check it out

Post by openBrain »

freedman wrote: Thu Jun 13, 2019 7:02 pm I knew there would be many issues with the buttons. I'm new to Python and FreeCAD structure
And here it's still another thing. Qt widgets layouting. Much to learn I admit. :)
I was running out of time to do this so to actually get something done I decided that if I saw something that worked use it. If I did otherwise I would probably never finish. :)
That was the way to go I think. ;) I myself released some macros, thus I know how hard it is to get some feedback on this. ;)
OpenBrain, I agree with just about everything on your list except for the last one. I don't know why there would be a default viewing.
Disagreement is allowed. :lol: It's not about a default, it's about "when you leave, let it as it was before". :)
I'm working, building my house, learning Python, writing macros. Doing this cost me about 10 hours of sleep. :)
Same kind of schedule here. :lol: I know what you're talking about. ;) Time is definitely the most precious resource. :)
If the group likes this enough maybe there is support to fix stuff. I know I just don't have the time. If someone wants to correct all the issues then Jump in, I just don't feel it's my place to ask.
Maybe don't ask, but just allow (or even impulse). It can also be understood that one wants to have the job done by himself. ;) Maybe it could be made easier on some coding place like github. ;)
freedman
Veteran
Posts: 3466
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: New macro, Vision1, check it out

Post by freedman »

It's kind of funny actually, for "pick", one line of code in addSelection() makes it work, when FreeCADGui.Selection.clearSelection() is executed it hides the object selection from FreeCAD and this allows the macro to do something instead.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: New macro, Vision1, check it out

Post by openBrain »

Would you have something against your toolbox to be converted to a dockable widget ?
freedman
Veteran
Posts: 3466
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: New macro, Vision1, check it out

Post by freedman »

My goal was to get the idea out there so I needed to make it functional enough for people to try it. I have the skills (C++,OOP) to do it, but I can't see it in my life-time at this point. I looked thru a dozen macros to get something that stayed on top, minimized correctly, make small, I couldn't find a good example. You may certainly work on, copy it, rename it, make it yours, publish it, (did I forget anything) just as long as I get to use it and it does about the same thing. Thanks :lol:
OpenBrain, I agree with just about everything on your list except for the last one. I don't know why there would be a default viewing.

Disagreement is allowed. :lol: It's not about a default, it's about "when you leave, let it as it was before". :)
I don't really see a before or after, this is just a tool installed all the time.

I would hope the developers see the need for this in version 0.20. :)

I had some plans to add more buttons that changed resolution all, high,med,low. Then a pick button to selectively pick objects to change their resolution. This could make low res. large models load in 1/10th the time, then pick the objects you want to make high res.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: New macro, Vision1, check it out

Post by openBrain »

freedman wrote: Thu Jun 13, 2019 8:45 pm
Hi freedman, attached what I roughly was thinking about. ;)
You can enable an extra feature that toggles the "single" mode with Ctrl+Shift by setting __KBSC__ to True at the top of the macro. I disabled it by default as it needs a model to be opened first (before running the macro) and it crashes FC when widget is docked then undocked. Can't figure out why. ;)
Attachments
VisionOB.FCMacro
(6.11 KiB) Downloaded 59 times
freedman
Veteran
Posts: 3466
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: New macro, Vision1, check it out

Post by freedman »

Wow! That looks good. I think I saw 2 lines of code that I wrote originally. :lol:
I think eventually this will be seen as a standard item for FreeCAD, it helps so much in the change from sketching to viewing.

I see what you mean about the docking issue, mine locks up also.

I always use the "Twin aero motor" as my test for a complex model. It is so cool to be able to move around and look inside of it, with almost no effort.

I will spend much time learning what you coded, thanks for that. I like the sliders also and the ability to adjust to 5%.

I have seen a design logic issue (from my version and yours), when going to sketcher the "user" on/off status should change to off. This will show the operator the panel is disabled. It could be re-enabled on exiting sketcher.

I really like the docking, I haven't tried it yet on my dual monitor system, later.

Go to go, it's Saturday, Thanks again. I will test a bunch next week.
Post Reply