Poll: PR to skip some task dialogs in Part workbench

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!

Should the ability to skip the dialogs be the default?

Yes, it saves some clicks.
14
74%
No, clicking is fun.
5
26%
 
Total votes: 19
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Poll: PR to skip some task dialogs in Part workbench

Post by TheMarkster »

https://github.com/FreeCAD/FreeCAD/pull/6380

About the poll, executive summary. There is a PR that will allow you to skip some of the dialogs in the Part Workbench by pre-selecting objects prior to executing the command. For example, select 2 sketches and click the Loft toolbar icon, and a Loft is created without opening the dialog. Select a sketch and a path, click the sweep toolbar icon, and a sweep object is created without the dialog. You can avoid skipping the dialog in 2 ways: 1) don't preselect anything, and 2) set a user preference NeverSkipDialog to True. The question for the poll is whether NeverSkipDialog should default to True or False. There are fairly specific requirements for skipping the dialogs. If there is a selection error, for example only 1 sketch for a loft, then the dialog is shown as before. So, there is no harm with an invalid pre-selection.

There is no change to the dialogs. They are either shown as before or not shown.

******************************************
The idea is to be able to bypass the task dialog sometimes for these 4 operations:

Part Extrude
Part Sweep
Part Loft
Part Revolve
  • Extrude: Select the profile to extrude in the Tree View and select an Edge in the 3D View to define the direction and length of the extrude.
    The Edge must be a straight edge line segment. The DirLink property is set to this Edge and the
  • Sweep: Select the profile(s) in the Tree View and the Path in the 3D View to define the sections and the spine. The spine edges must all be subojects of the same spine object. Use a SubShapeBinder if needed. These work in Part, but you need to create them in Part Design and drag them out of the body.
  • Loft: Select the profiles in the Tree View or 3D View (since no subobjects are applicable here). A Vertex can be used for one of the profiles, for example to make a pyramid, but it must be an object with only a single vertex, e.g. Part::Vertex or Draft::Point or a sketch with only a single non-construction mode Point.
  • Revolve: Select the profile in the Tree View and the edge to use as a reference in the 3D View. The reference can be a line segment or an arc.
    The AxisLink property is set to this edge.
Solid = True will be the setting if the first profile selected is closed, else Solid = False, and a warning is printed in the report view informing the user that Solid = False.

If the selection is invalid, then the dialog is shown. This is implemented in a python script file. If there is a runtime error in the script this is detected and the dialog is shown.

The dialog is not populated with anything from the selection unless that is already the case, such as with Extrude and Revolve where the selected profiles are used. Basically, this will change nothing about the current implementation of the dialogs. The dialogs are either skipped or shown and work exactly like before.
Last edited by TheMarkster on Wed Feb 16, 2022 4:49 am, edited 3 times in total.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Part Workbench PR: skip task dialog when we can infer from the selection what is desired

Post by TheMarkster »

I added an option to never skip the dialog. This can be set in parameters:

BaseApp/Preferences/Mod/Part/NeverSkipDialog

False = skip the dialog when appropriate objects have been selected in the tree and appropriate subobjects have been selected in the 3d view. Default is False. If set to True the dialogs are never skipped.

If you think True should be the default now is the time to weigh in.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Workbench PR: skip task dialog when we can infer from the selection what is desired

Post by chrisb »

TheMarkster wrote: Thu Jan 13, 2022 5:05 pm The dialog is not populated with anything from the selection unless that is already the case,
I don't quite understand this. Do you mean you don't preselect the sections for Loft and Sweep and in the latter case the path? (I always wonder why they weren't preselected.)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Part Workbench PR: skip task dialog when we can infer from the selection what is desired

Post by TheMarkster »

The dialog is skipped, not populated. In the case of a sweep, the sweep is made using the selected profiles and path edges. Profiles / sections must be selected in the tree view, while path edges are selected in the 3d view. If the first selected profile is closed, then solid = true. Frenet is false. You can change these in the Sweep object's properties, of course. In case of a selection error (for example, no path edge selected) then the dialog is shown and works exactly as before.

With this a sweep can be very quickly done. You select your sketch, then your path edge, click the toolbar icon. Done. Only thing you might need to do is toggle frenet mode in the properties.
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: Part Workbench PR: skip task dialog when we can infer from the selection what is desired

Post by adrianinsaval »

Isn't it better to populate the dialog with the inferred properties rather than fully skipping the dialog, yes you can edit the properties later but this is a lot less user friendly than doing it in the dialog to begin with. And you're only saving yourself one hit of Enter in case it has what you wanted. I vote for default true.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Workbench PR: skip task dialog when we can infer from the selection what is desired

Post by chrisb »

I too would vote for showing the dialog by default, and it would be great to have it populated with the preselection. And if that code exists, it may even be used for editing an existing loft.
:mrgreen: :mrgreen:
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Workbench PR: skip task dialog when we can infer from the selection what is desired

Post by chrisb »

Does the sequence of the selection matters for a sweep? Otherwise something like these two circles could create a non desired result:
SnipScreenshot-24a742.png
SnipScreenshot-24a742.png (3.17 KiB) Viewed 3774 times
SnipScreenshot-8bd195.png
SnipScreenshot-8bd195.png (34.6 KiB) Viewed 3774 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Part Workbench PR: skip task dialog when we can infer from the selection what is desired

Post by TheMarkster »

A similar functionality already exists in MeshRemodel workbench with this icon:
Snip macro screenshot-6c4611.png
Snip macro screenshot-6c4611.png (30.8 KiB) Viewed 3722 times
It's not the same code. I did not reuse it, but rather reimplemented again in python, so the behavior might not be exactly the same, but should be very close to the same. If not as described here, then I would consider that a bug in MeshRemodel. In the workbench all 4 functions use the same icon and it is distinguished which tool to use based on the keyboard modifiers being used, for example Ctrl + Click for sweep. But you could do some tests with it to get a feel for how this would work.

As to chrisb's question about the 2 circles doing a sweep. The circle selected in the tree would be the profile and the circle selected in the 3d view would be the path for the sweep. There is no possibility of an undesired result, or at least, it won't be any different from the same result achieved with using the same objects in the dialog. If both circles are selected in the tree, then you get the dialog. If both are selected in the 3d view, then you get the dialog. To skip the dialog you must select one circle in the tree and the other in the 3d view.

It is important to understand that the dialog is never skipped unless appropriate preselections are made. It would be rare that a dialog is accidentally skipped because the preselection requirements are quite precise. Setting NeverSkipDialog to True by default means the dialogs are never skipped, no matter the preselection, essentially removing this functionality for all users except those few who know about turning the feature on.

If it is False, then here are the cases where the dialogs get skipped.

Extrude: dialog is skipped only when a valid profile is selected in the tree and a valid edge is selected in the 3d view. The edge must be a straight edge or else the dialog is shown. There can only be one edge or else the dialog is shown. The edge must be selected in the 3d view or else the dialog is shown. It's unlikely the dialog will ever be skipped by accident. Simply selecting a profile, such as a sketch, and clicking the icon will not result in skipping the dialog. If more than 1 profile is selected, then the dialog is shown.

Revolve: same as for extrude except here the selected edge may also be an arc, in which case the center of the arc is the center of the revolve and the axis the axis of the rotation.

Sweep: in order to skip the dialog you must select one or more valid profiles in the tree view, and at least 1 edge in the 3d view. If more than 1 edge is selected and the edges belong to different objects, then you get the dialog. If 1 or more selected profiles contain more than 1 wire (currently unsupported for sweep and loft) then you get the dialog.

Loft: this is a bit different because no valid path elements are involved, unlike the other 3 cases. Therefore, you may select the profiles either in the tree or the 3d view, it doesn't matter. All that is needed to select 2 or more profiles in order to skip the dialog.

For all cases, anytime you don't want to skip the dialog, then don't select anything in the 3d view, and in the case of the loft, don't select more than 1 thing in the tree view.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Part Workbench PR: skip task dialog when we can infer from the selection what is desired

Post by TheMarkster »

I have come up with a way for you to be able to test the PR. Copy the attached SkipGui.py file to your BasicShapes folder. This can be found with App.getHomePath() in the python console, Go to the folder returned by that command, and then go to Mod/Part/BasicShapes and put SkipGui.py there. Should be homePath()/Mod/Part/BasicShapes/SkipGui.py when you are done. (The file will have no effect unless calling it from the python console manually.)

Then in the python console:

Code: Select all

from BasicShapes import SkipGui as SG
(SG just makes it easier to type in later.)

With that done select objects to test, some in the tree, some in the 3d view and test the function you wish to test. For example, select 2 sketches in the tree and enter:

Code: Select all

SG.makeLoft()
If you get a return value of False, it means the dialog would be shown. (It won't be shown here because the code to do that is in C++.) False means the dialog was not skipped. Think of the call to SG.makeLoft() as a question, was the dialog skipped? If False, then C++ will open the dialog.

The function names:

SG.makeLoft()
SG.makeExtrude()
SG.makeRevolve()
SG.makeSweep()

If you have made a proper selection of objects in order for the dialog to be skipped, then you will get a new object in the tree, such as Loft.

Edit: I forgot to mention if you enable logging in the report view you will see the reason the dialog was not skipped in cases where False is the return value. Note also: entering, e.g. SG.makeSweep() would be the same as clicking the sweep command toolbar icon once the PR is merged with the only difference being you would get the dialog there when False is returned and instead of entering the command in the console you would clicking the toolbar icon (or from the menu or keyboard shortcut).
Attachments
SkipGui.py
(10.19 KiB) Downloaded 27 times
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: Poll: PR to skip some task dialogs in Part workbench

Post by adrianinsaval »

I would appreciate if the "No" poll option better represented the argument for it "clicking is fun" is very misleading. Polls should be neutral and not try to direct the voters to OP's preferred answer.
Post Reply