More helpful "need active body" message

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!
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

More helpful "need active body" message

Post by jnxd »

I wanted to run a small UI improvement idea I was trying for the PartDesign workbench, and would like some input from the community before spending more time on it. It is intended to make life slightly easier by replacing the dialog box, telling the user there is no active body, with another containing a combo-box with present bodies to make active.

A similar issue is mentioned in an old bug report issue #4288 from March 2020. There the OP's issue seemed to arise from following instructions for an older version of FreeCAD. However I do concur that dialog box could be more useful. Currently, if a user tries to create a part design feature without an active body when there are multiple bodies present, they are presented with an error box like one of the following:
error-pd-new-sketch-and-primitive.png
error-pd-new-sketch-and-primitive.png (20.65 KiB) Viewed 1604 times
error-pd-other-features.png
error-pd-other-features.png (30.79 KiB) Viewed 1604 times
Instead, I propose we add a combo-box containing the bodies to the message as follows:
proposed-new-dialog.png
proposed-new-dialog.png (22.23 KiB) Viewed 1604 times
The box will also have an option to create a new body and make it active instead.

I have put up the work done so far here: https://github.com/AjinkyaDahale/FreeCA ... e-body-qol.

I spent a few hours putting together the dialog for a new sketch because it was relatively straightforward. However, after changing the dialog box I also had to change the flow of the command so it continues after throwing the dialog and doesn't just return. The "new sketch" command (also the "primitive" command) does not ask the PartDesign::getBody() function to throw the error message, and instead throws it separately. If I wanted to make the change for all other PD features, I suspect I will have to alter the behavior of ALL the commands that use PartDesign::getBody() in order for this to work smoothly, or make changes in the function itself.

So before I proceed further I would like to know if people have any inputs regarding this, either on the new UI or on it's implementation. Please feel free to ask for any clarifications because I might have gone too much into the details of the implementation.
My latest (or last) project: B-spline Construction Project.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: More helpful "need active body" message

Post by chrisb »

If possible I would prefer a list over a drop down menu. But even more important, I would like to see an educated guess which body to activate. With a new sketch or a new primitive no guess can be made and you have of course to ask the user.

But this dialog occurs as well, if a new feature is created, i.e. a new pad, pocket, ... In these cases the new feature should obviously belong to the same body as the current selection and I would like to see that body activated.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: More helpful "need active body" message

Post by GeneFC »

I wonder how important this might be?

Unless the tree is already very long the available bodies are clearly shown. What does this extra coding and verbiage add?

I see this message once in a while, but I instantly know what to do.

I believe even beginners will be confused only once.

Gene
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: More helpful "need active body" message

Post by jnxd »

chrisb wrote: Wed Jul 28, 2021 7:22 am If possible I would prefer a list over a drop down menu. But even more important, I would like to see an educated guess which body to activate. With a new sketch or a new primitive no guess can be made and you have of course to ask the user.

But this dialog occurs as well, if a new feature is created, i.e. a new pad, pocket, ... In these cases the new feature should obviously belong to the same body as the current selection and I would like to see that body activated.
I don't expect it'd be too hard to change it to a list if people want that.

I was also thinking of maybe having an educated guess for the selected body, but I don't believe it'll be that straightforward. It's probably very much doable however: if something is selected in the view-port, find the body it belongs to and select it in the drop-down (regardless of what feature is being created, to avoid implementation complication).
GeneFC wrote: Wed Jul 28, 2021 2:31 pm I wonder how important this might be?

Unless the tree is already very long the available bodies are clearly shown. What does this extra coding and verbiage add?

I see this message once in a while, but I instantly know what to do.

I believe even beginners will be confused only once.

Gene
I would say it's a matter of convenience. Consider the following case:
Screenshot at 2021-07-28 14-29-10.png
Screenshot at 2021-07-28 14-29-10.png (176.83 KiB) Viewed 1456 times
We have two bodies, none active, and we have selected a face on one of them. We are on "tasks" in the combo view.
Old way:
1. Press "create sketch"
2. Error box appears press ok.
3. Switch to model view, right click/double click on body and make active (doesn't happen by double clicking in view-port). This will clear our face selection.
4. Select the face again.
5. Press "create sketch" again.

New way:
1. Press "create sketch"
2. Dialog box appears. Select body and press OK. We are in sketcher

Now that I look at it, it seems implementing it for the rest of the features is more probably more straightforward than I thought: simply replace the old message in getBody() with a call to the new one, possibly with a new message.
My latest (or last) project: B-spline Construction Project.
wieszak17
Posts: 250
Joined: Fri Jan 10, 2014 7:59 pm

Re: More helpful "need active body" message

Post by wieszak17 »

GeneFC wrote: Wed Jul 28, 2021 2:31 pm I wonder how important this might be?
It is a QOL, and it is very nice to have such things. This message is one of annoying ones, and implementing Chrisb's proposition would be very welcomed.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: More helpful "need active body" message

Post by GeneFC »

wieszak17 wrote: Wed Jul 28, 2021 7:01 pm It is a QOL
I know lots of jargon too.

What is a QOL? :mrgreen:

Gene
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: More helpful "need active body" message

Post by jnxd »

GeneFC wrote: Wed Jul 28, 2021 7:16 pm What is a QOL? :mrgreen:
Quality of life
My latest (or last) project: B-spline Construction Project.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: More helpful "need active body" message

Post by GeneFC »

jnxd wrote: Wed Jul 28, 2021 3:03 am I suspect I will have to alter the behavior of ALL the commands that use PartDesign::getBody() in order for this to work smoothly, or make changes in the function itself.

So before I proceed further I would like to know if people have any inputs regarding this, either on the new UI or on it's implementation.
I was responding.

The first line I quoted above is pretty worrisome. Altering the behavior of "ALL" should not be take lightly.

If you don't want responses don't ask, just do it. :roll:

Gene
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: More helpful "need active body" message

Post by jnxd »

GeneFC wrote: Wed Jul 28, 2021 7:19 pm
jnxd wrote: Wed Jul 28, 2021 3:03 am I suspect I will have to alter the behavior of ALL the commands that use PartDesign::getBody() in order for this to work smoothly, or make changes in the function itself.

So before I proceed further I would like to know if people have any inputs regarding this, either on the new UI or on it's implementation.
I was responding.

The first line I quoted above is pretty worrisome. Altering the behavior of "ALL" should not be take lightly.

If you don't want responses don't ask, just do it. :roll:

Gene
The response is indeed appreciated. And agreeably changing code in all commands would need a rather good amount of testing. However, it does really seem that I just need to make changes in a couple of places, and a change at one spot won't affect the others.

As for the last line, I would definitely skip doing it if the response was overwhelmingly negative, or if there was a reason apart from "it wouldn't be that useful". That said, there are some implementation level questions I have, for which I could use some input from someone with a good knowledge of PartDesign.
My latest (or last) project: B-spline Construction Project.
Bance
Veteran
Posts: 4185
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: More helpful "need active body" message

Post by Bance »

I'm a little like Gene in respect of the fact that I don't really care about this much, however I am very pleased that you care enough to make this change.

This is a prime example of FOSS "I think I can improve this, so I will :D "

I hope this leads you to make other contributions....
Post Reply