Automatically create body?

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Automatically create body?

Post by ian.rees »

Just a little UI question - If there is no body at all, is there a situation where it would be wrong for FreeCAD to create a new body instead of popping up this modal? -Ian-
Screen Shot 2017-03-19 at 11.02.31 AM.png
Screen Shot 2017-03-19 at 11.02.31 AM.png (46.76 KiB) Viewed 2929 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Automatically create body?

Post by DeepSOIC »

Maybe. It may create a new body even if there are bodies already, just one isn't active. I think making New Sketch and Addtive <Primitive> commands may do it. Maybe datum features too, but that is more questionable. Remaining tools require input shapes that should be already in a body, so they shouldn't create bodies.
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Automatically create body?

Post by jnxd »

I was thinking on the same lines, though I planned to suggest making any available bodies active. We could have a dropdown of sorts, with one of the options being "add new body".

The message must also restrict the option to the parent body if, say a sketch is to be edited.
My latest (or last) project: B-spline Construction Project.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Automatically create body?

Post by ian.rees »

DeepSOIC wrote: Remaining tools require input shapes that should be already in a body, so they shouldn't create bodies.
Ahh, good point. So, perhaps it should only make the new body automatically for operations that don't depend on other shapes.
jnxd wrote:We could have a dropdown of sorts, with one of the options being "add new body".
I'm probably not following your suggestion, but generally I'm not a fan of adding UI elements when there's already UI for a particular task. To me, the modal popup makes sense when FreeCAD can't know what to do. I'm just suggesting that in the specific case of a document with no bodies, the "right" thing to do is sometimes obvious enough that it shouldn't require more clicks or any questions from FreeCAD.

Basically, the issue I have with the popup is that it adds a click to my usual workflow (which starts by making a sketch), where I don't see any benefit. Will think about it a bit more and maybe come up with some proposed code changes in a few days. -Ian-
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Automatically create body?

Post by jnxd »

ian.rees wrote: I'm probably not following your suggestion, but generally I'm not a fan of adding UI elements when there's already UI for a particular task. To me, the modal popup makes sense when FreeCAD can't know what to do. I'm just suggesting that in the specific case of a document with no bodies, the "right" thing to do is sometimes obvious enough that it shouldn't require more clicks or any questions from FreeCAD.

Basically, the issue I have with the popup is that it adds a click to my usual workflow (which starts by making a sketch), where I don't see any benefit. Will think about it a bit more and maybe come up with some proposed code changes in a few days. -Ian-
What I suggest is simply "You need an active body to perform this action. Please select a body to activate." and give the user the options, including creating a new body. This is only necessary if there are any bodies and we are not going to edit something already present. Indeed if there is no body, we should default to creating a new one automatically, and if the user is editing something, we should directly switch to the body the feature/sketch belongs to, or create a body and put said feature/sketch into it. However, when a body is made, the user might want to rename it, and in any case, we should indicate to the user that bodies are needed, just in case they don't know about PDN.
My latest (or last) project: B-spline Construction Project.
User avatar
kkremitzki
Veteran
Posts: 2511
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Automatically create body?

Post by kkremitzki »

In this thread I talked about changing the "Create Body/Create Part" introductory Task Panel. I looked into it, and figured the most straightforward fix would be to add a button that has a "pick amongst the bodies in the document" button to replace the "create part" button. I wasn't sure if it would be worth implementing but I think it might be based on this thread.

If I made something like that, it could have an optional "before" message passed to it by e.g. the code that runs when you click a button and don't have an active part. That way, it would be something like:
|=============|
|- BodyPicker -|
|=============|
|<custom msg>|
|=============|
| - Workspace -|
|-|--> Body ----|
|-|--> Body001-|
| - Body002 --- |
| -Create body-|
|=============|
Then this could get called whenever a PartDesign button is clicked and no Body is found in the document.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Automatically create body?

Post by ian.rees »

jnxd - sorry I'm still not following, but there seems to be a lot more going on in your post than what I'm proposing. What I want is one less click in the workflow that goes "Start FreeCAD, create sketch, ...".
kkremitzki wrote:In this thread I talked about changing the "Create Body/Create Part" introductory Task Panel.
I think the Task Panel is problematic in general; I think most uses of it make FreeCAD too modal. But, that's diverging from this thread, I'll go post there...

Anyways, if I can get around to it in the next few days, I'll try to implement my proposed change and see what people think about it. -Ian-
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Automatically create body?

Post by ian.rees »

simonvanderveldt
Posts: 62
Joined: Tue Mar 14, 2017 2:11 pm

Re: Automatically create body?

Post by simonvanderveldt »

ian.rees wrote:Basically, the issue I have with the popup is that it adds a click to my usual workflow (which starts by making a sketch), where I don't see any benefit. Will think about it a bit more and maybe come up with some proposed code changes in a few days. -Ian-
+1 for addressing the simple use case of a user with an empty document/a document without a body who runs an action that needs a body by automatically creating a body would be a nice fix to streamline this basic/simple workflow.
I still run into this every now and then.

In other situations where there already exists a body, that body might or might not be the one the user wants to use, which makes it a bit more complicated. So maybe leave that for now?
ian.rees wrote:How does this look? https://github.com/ianrrees/FreeCAD_tin ... -auto-body -Ian-
Nice! Small question: Where does the text in the current pop-up come from? I expected a changed message but I only see additions.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Automatically create body?

Post by DeepSOIC »

ian.rees wrote:How does this look? https://github.com/ianrrees/FreeCAD_tin ... -auto-body -Ian-
Add it for primitives too, I think. Thus, it may be a good idea to wrap the code you added to new-sketch command into a standalone routine, like "autoNewBody()"...
Post Reply