PartDesign: inverse Pocket

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!
rynn
Posts: 453
Joined: Tue Jul 31, 2018 7:00 am

PartDesign: inverse Pocket

Post by rynn »

Hello,

I often have the problem that I want to cut away everything in PartDesign except a certain shape. Until now I have always done this by drawing a sufficiently large box around the drawing and then using the Pocket feature.
I would like it better if there was a possibility to inverse the function of the pocket feature, i.e. not to cut away the sketch, but everything except the sketch. I implemented that: PR #4828

Any comments? Is this really as useful as I think?
Screenshot_pocket_inverse.png
Screenshot_pocket_inverse.png (109.21 KiB) Viewed 6885 times
User avatar
jonasb
Posts: 162
Joined: Tue Dec 22, 2020 7:57 pm

Re: PartDesign: inverse Pocket

Post by jonasb »

I think this is very useful indeed! Saves us from creating, constraining, and maintaining, a surrounding box.

Beside pockets, I find myself using such surrounding shapes when creating grooves, too. Any chance to add this feature also for grooves?

In my eyes the name "inverse pocket" sounds a bit strange though. If I think of the inverse of a pocket, it's a pad. What do you think about "inside out"?
user1234
Veteran
Posts: 3261
Joined: Mon Jul 11, 2016 5:08 pm

Re: PartDesign: inverse Pocket

Post by user1234 »

Hello!

Yes and no. I also miss the common operation, i would not implement it in that way. I would make it like the other add and cut operation in PartDesign, each operation a command. But instead cluttering the GUI, all in a dropdown menu, like the seldon used commands in add and cut. (I hope yo understand me what i mean).

Thanks for working on it.

Greetings
user1234
Attachments
00.png
00.png (39.02 KiB) Viewed 6854 times
openBrain
Veteran
Posts: 9031
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: PartDesign: inverse Pocket

Post by openBrain »

This probably is very useful (it had been discussed several time).
But IMO it lacks sense to introduce it on only one operation. It shall better be implemented in one go on all operations.

I had a look at the PR and code looks good to me.
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: PartDesign: inverse Pocket

Post by adrianinsaval »

Very useful feature indeed, it would be really nice if you could implement that toggle for the other subtractive operations (except hole)
user1234 wrote: Wed Jun 02, 2021 7:49 pm Yes and no. I also miss the common operation, i would not implement it in that way. I would make it like the other add and cut operation in PartDesign, each operation a command. But instead cluttering the GUI, all in a dropdown menu, like the seldon used commands in add and cut. (I hope yo understand me what i mean).
I am of the opposite opinion, I think just having a toggle in the task is the simplest and best way for this.
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: PartDesign: inverse Pocket

Post by adrianinsaval »

I decided to take the initiative and extend the functionality to other features and while doing so discovered that the substractive helix already has this feature implemented. I think the wording used there is more clear:
Screenshot_20210703_175457.png
Screenshot_20210703_175457.png (24.83 KiB) Viewed 5953 times
I made a PR to this PR's branch with my additions however I don't think I can write the code for the GUI side of things, is anyone else willing to help with that?
Would like to get some feedback on the code too, is the way I added the property for the many primitives correct or is there a better approach?
The implementation currently also adds a useless "Outside" property to many additive features too, is that ok? (this is already the case with helix)
uwestoehr wrote:
I think you implemented the helix feature? Thoughts?

EDIT: added the checkboxes to the ui files since I can do at least that but as no C++ code interact with them they do nothing and would also be shown in additive lofts, sweeps and primitives so they shouldn't be merged like that.
Last edited by adrianinsaval on Sun Jul 04, 2021 1:33 am, edited 1 time in total.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: PartDesign: inverse Pocket

Post by chrisb »

I think it was
davidosterberg wrote: David.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: PartDesign: inverse Pocket

Post by adrianinsaval »

In the end I did implement the GUI side of things so I think it's ready, I don't actually have much knowledge of C++ though so I would appreciate it if someone carefully reviewed my code (https://github.com/berberic2/FreeCAD/pull/1/files)
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: PartDesign: inverse Pocket

Post by adrianinsaval »

Ok adding this feature is not as simple as it looked, the pattern features don't know how to deal with them and just do a regular cut with them. Take a look at this file, the helix is set to remove outside of it so it uses the boolean common but the linear pattern afterwards just cuts away the helix shape. I used a helix because anyone can see the behavior even in stable freecad but the same happens with the other features.
outsideHelixPattern.FCStd
(183.39 KiB) Downloaded 108 times
I think it would be necessary to change the getAddSubShape function in FeatureAddSub.cpp and how the patterns work, thoughts? that seems out of my league.

Also, while I was trying to extend the "outside" feature for "up to face" and "up to first" pockets I realized that the subshape that is currently saved for those features isn't what I believe it should be. Unlike a dimension driven pocket, it saves the shape that was removed (effectively a boolean common between the equivalent pad and the baseshape), not the shape that was used for the cut. I'm not sure how to explain this but i have an example file showing the difference:
pocketPatternComparison.FCStd
(77.65 KiB) Downloaded 108 times
Screenshot_20210704_160828.png
Screenshot_20210704_160828.png (37.07 KiB) Viewed 5822 times
The circular pocket at the right of the box at the right is a pocket up to the upper face of the box, you can see the pattern that was made using that pocket removes the same shape that was removed in the pocket.
In contrast, the circular pocket at the right of the left box uses a dimension and the corresponding pattern doesn't just remove the shape that was removed but what would be removed if the pocket was moved. I think this is a bug and have something in mind to fix it at least for "up to face" I believe it would be inevitable with "up to first". Thoughts?
User avatar
czinehuba
Posts: 158
Joined: Mon Oct 15, 2018 4:59 am
Location: UK
Contact:

Re: PartDesign: inverse Pocket

Post by czinehuba »

jonasb wrote: Wed Jun 02, 2021 7:43 pm
In my eyes the name "inverse pocket" sounds a bit strange though. If I think of the inverse of a pocket, it's a pad. What do you think about "inside out"?
This operation is called "intersect" in other CAD software.

Yes. It is a missed tool in freecad...
Post Reply