#4828 PartDesign: inverse for pocket

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
jonasb
Posts: 162
Joined: Tue Dec 22, 2020 7:57 pm

Re: #4828 PartDesign: inverse for pocket

Post by jonasb »

TheMarkster wrote: Wed Jan 05, 2022 6:05 pm Using common could work with the pocket itself in some cases, as you've mentioned, such as through all, but the problem with that will be if the user decides to use the pocket in a pattern feature. For example, a polar pattern would use the pocket's AddSubShape (what you would get extruding the sketch basically) as a cutting tool when making the copies. This is because the polar pattern code assumes a cut was used for the original pocket. Maybe the pattern tools could be modified to work with such pockets, but even at best it would be adding much complexity to the source code. Better, I think, to expand the profile so that nothing needs to be done with pattern tools. Such a thing would also make it clearer to the user exactly what is happening.
I think the interop any with pattern will be problematic, no matter whether an "outside wire" is somehow generated and used with "cut" or if "common" is used. The only difference is how "outside" is defined: Only in the profile's H/V-plane, or along the normal, too (assuming you have a profile. For subtractive primitives there is no ambiguity and "common" results in the desired effect).
In any case, you as a user explicitly stated: Remove everything outside, i.e. keep only what's inside my profile or primitive. However, linear/polar/array patterns or mirroring are made for applying some feature somewhere else, usually beyond the original profile. And by definition, there is nothing left outside of your initial profile/primitive where you could apply an additional removal.

So I think we should just disallow any pattern/mirroring on subtractive features when the "remove outside" option is used.

There may be some corner cases when you define "outside" in the H/V-plane, which makes sense for pockets, and then pattern this outside-pocket on an axis outside of this plane. Or if you pattern with a distance smaller then the profile's extend, resulting in self-intersection. But for those cases, you can still do what's already possible Today: Draw the "outside-wire" yourself, the way you need it for your pattern, and don't use the "remove outside" option. Or use go for options such as the "beastly" PDWrapper macro, if the additional complexity if justified. In all other cases, "remove outside" could/should help to reduce complexity for the user.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: #4828 PartDesign: inverse for pocket

Post by chrisb »

Here is an example where it is sensible to use a pattern on a remove-everything-outside pocket. I wouldn't rate it as a corner case:
I took a cube and and removed a triangle:
SnipScreenshot-d5b0b6.png
SnipScreenshot-d5b0b6.png (4.33 KiB) Viewed 3493 times
A PolarPattern removes then all four corners:
SnipScreenshot-ad8601.png
SnipScreenshot-ad8601.png (3.58 KiB) Viewed 3493 times
Attachments
patternedInversePocket.FCStd
(20.36 KiB) Downloaded 58 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
jonasb
Posts: 162
Joined: Tue Dec 22, 2020 7:57 pm

Re: #4828 PartDesign: inverse for pocket

Post by jonasb »

chrisb wrote: Thu Mar 02, 2023 12:18 am ... I wouldn't rate it as a corner case
Touchée. This looks indeed like a not-so-uncommon application of a self-intersecting pattern.

From all that I learned in the past year about the inner workings of the PartDesign WB, I also come to the conclusion that it's more work to prevent such patterning than to just let it happen. I mean, to prevent it, we have to become active.

your scenario is something we have to keep in mind when implementing this "remove outside" in combination with 2D profiles (for subtractive primitives, i.e. 3D, using a boolean Common "just works"): When using the bounding box as a means to generate the "outside wire", one must use a sufficiently large overhead to still allow for e.g. rotations, as in your example.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: #4828 PartDesign: inverse for pocket

Post by chrisb »

jonasb wrote: Thu Mar 02, 2023 8:14 pm your scenario is something we have to keep in mind when implementing this "remove outside" in combination with 2D profiles (for subtractive primitives, i.e. 3D, using a boolean Common "just works"): When using the bounding box as a means to generate the "outside wire", one must use a sufficiently large overhead to still allow for e.g. rotations, as in your example.
I am very glad to see that you are rather interested in solving the issue than wanting to be right. I admit that a similar simple example for a linear pattern didn't spring immediately to mind. I am usually against too restrictive behaviour, because I often have seen people using software in a way that was never thought of by the developers, yet it was sensible to do so. This loads of course more responsibility on the users.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
FBXL5
Posts: 979
Joined: Sat Aug 03, 2019 8:45 pm

Re: #4828 PartDesign: inverse for pocket

Post by FBXL5 »

I think these images show clearly why an inverse pocket is not the same as the result of a boolean common operation:
A boolean common would end where the inverse pocket ends.

Subtracting the inner area leads to a fork link while subtracting the outer area results in the counterpart.
Snip macro screenshot-16ecc3.png
Snip macro screenshot-16ecc3.png (20.55 KiB) Viewed 3369 times
The same profile can create inner or outer geometry such as screw drives
Snip macro screenshot-14ca47.png
Snip macro screenshot-14ca47.png (21.77 KiB) Viewed 3369 times
chrisb wrote: Thu Mar 02, 2023 8:54 pm This loads of course more responsibility on the users.
That is true, but I think this is no problem. Whenever I cut off the outside area of a profile there was no need to pattern this operation.
It is just a point to keep in mind and tell less experienced users to keep forum traffic low (could be notes on the relevant wiki pages).
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: #4828 PartDesign: inverse for pocket

Post by adrianinsaval »

chrisb wrote: Thu Mar 02, 2023 8:54 pm I admit that a similar simple example for a linear pattern didn't spring immediately to mind.
another simple example is a linear pattern along the the sketch normal, the removed portion don't even intersect in that case.
I am usually against too restrictive behaviour, because I often have seen people using software in a way that was never thought of by the developers, yet it was sensible to do so.
+1, this is why the single solid rule is so disappointing too.
This loads of course more responsibility on the users.
I don't think so, either way they would have faced a failure and have to rethink their modelling.
User avatar
jonasb
Posts: 162
Joined: Tue Dec 22, 2020 7:57 pm

Re: #4828 PartDesign: inverse for pocket

Post by jonasb »

adrianinsaval wrote: Fri Sep 17, 2021 12:59 pm I plan on eventually working on it, but no promises on when. Of course if someone else wants to do it they're welcomed.
Is this still up to date? I just came across another case where I'd need a "remove outside": cutting a spline into a given shaft. In this case, the profile used for "outside removal" is the PartDesign's Involute Gear -- not a Sketch. So here the usual workaround of just add another closed wire, far enough from the region of interest, and use the pocket as-is simply does not work.

Of course, one could reorganize the model, split the shaft, and use the gear profile in an additive feature. But it's much more convenient to model the original shaft first using a simple sketch and revolve, keeping the overall dimensions in a single place. And when you want to do remove the outside of a multi-section sweep, like in this example, you currently have to jump through a lot of hoops, making the task even more complex.


PS: Thanks chrisb for splitting the single-body-discussion of into it's own topic. Let's keep this one focused on the "remove outside" feature.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: #4828 PartDesign: inverse for pocket

Post by adrianinsaval »

instead focus discussion to issue #8706 please, yes I still intend on working on this, if you can provide a file for your usecase so that I may test it once the time comes
wsteffe
Posts: 461
Joined: Thu Aug 21, 2014 8:17 pm

Re: #4828 PartDesign: inverse for pocket

Post by wsteffe »

I do not understand the need to add the option "Remove outside" to a pocket considering that you may already get the same result adding (to the sketch) a closed profile (in example a rectangle) which encloses the sketch and the projection (on the sketch plane) of the base feature.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: #4828 PartDesign: inverse for pocket

Post by chrisb »

wsteffe wrote: Wed Mar 22, 2023 10:49 am I do not understand the need to add the option "Remove outside"
Because
- it is quite natural,
- it would remove the need to think about the size of the outer frame
- less constraints
- easier to make fully constrained
and probably more.

It's not a big deal, because we all know how to do it - well newbies come regularly and ask for it - but it would be an improvement nevertheless.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply