#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!
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: #4828 PartDesign: inverse for pocket

Post by chrisb »

Fixed the image above. The issue was of course the recompute, which did on my precompiled version the same as the normal pocket - of course.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
rynn
Posts: 454
Joined: Tue Jul 31, 2018 7:00 am

Re: #4828 PartDesign: inverse for pocket

Post by rynn »

PR is closed.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: #4828 PartDesign: inverse for pocket

Post by openBrain »

rynn wrote: Fri Sep 17, 2021 12:12 pmPR is closed.
Do you plan to still work on this to get expected behavior ?
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: #4828 PartDesign: inverse for pocket

Post by chrisb »

openBrain wrote: Fri Sep 17, 2021 12:15 pm Do you plan to still work on this to get expected behavior ?
It would be appreciated!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: #4828 PartDesign: inverse for pocket

Post by adrianinsaval »

I plan on eventually working on it, but no promises on when. Of course if someone else wants to do it they're welcomed. If I fail should resubmit the changes from this PR?
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: #4828 PartDesign: inverse for pocket

Post by TheMarkster »

adrianinsaval wrote: Fri Sep 17, 2021 2:39 am sorry, guess I rushed too much, the sketches would be on the XZ plane, their projections highlighted in orange
drawing.png
Also, here's a file showcasing this, you should be able to open it in regular FreeCAD but recomputing the pocket in the first body would turn it into a regular pocket just like the second body.
If you select the regular pocket and run the PDWrapper macro, selecting common additive as the wrapper type, you get the desired result.
Snip macro screenshot-92642b.png
Snip macro screenshot-92642b.png (45.27 KiB) Viewed 5513 times
With patterning tools, if you make linear pattern you will get repeated copies of this common boolean result and they will be fused with existing material since the wrapper is an additive type. If you select the common subtractive type, then the pattern tool will cut material from where the copies are placed.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: #4828 PartDesign: inverse for pocket

Post by adrianinsaval »

TheMarkster wrote: Sat Dec 11, 2021 6:00 am If you select the regular pocket and run the PDWrapper macro, selecting common additive as the wrapper type, you get the desired result.
No, the desired result is the T shape, you get the same result as the PR with that method
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: #4828 PartDesign: inverse for pocket

Post by TheMarkster »

adrianinsaval wrote: Mon Dec 13, 2021 2:00 pm
No, the desired result is the T shape, you get the same result as the PR with that method
I see. I updated WireFilter macro to include as one of the facemaker types "InvertedFace".

Original sketch in a new body created from your example:
Snip macro screenshot-68dc4b.png
Snip macro screenshot-68dc4b.png (66.35 KiB) Viewed 5266 times
WireFilter made from sketch with regular face (facemakerbullseye): Note: box is hidden because of z-fighting making it difficult to see the new face.
Snip macro screenshot-c602d5.png
Snip macro screenshot-c602d5.png (38.33 KiB) Viewed 5266 times
WireFilter now with new face type: "InvertedFace" (instead of facemakerbullseye):
Snip macro screenshot-b94f46.png
Snip macro screenshot-b94f46.png (52.35 KiB) Viewed 5266 times
(Note the new facemaker type: "InvertedFace" and the new property InvertedFaceScale (default: 5 currently).

Then the pocket made from the WireFilter: (If multiple faces, select the faces in the 3D view for the pocket -- pocket needs to be reversed in this case)
Snip macro screenshot-49cfee.png
Snip macro screenshot-49cfee.png (43.64 KiB) Viewed 5266 times
Inverted Face Scale property only scales the outerwire.
Attachments
WireFilter.FCMacro
(36.24 KiB) Downloaded 86 times
User avatar
jonasb
Posts: 162
Joined: Tue Dec 22, 2020 7:57 pm

Re: #4828 PartDesign: inverse for pocket

Post by jonasb »

TheMarkster wrote: Mon Dec 13, 2021 7:43 pm Note the new facemaker type: "InvertedFace" and the new property InvertedFaceScale (default: 5 currently)
As a potential "Remove Outside" property for PartDesign's Pocket and Groove operation does not need to be as universal as your wire filter, calculating this "outside wire" based on the base feature's bounding box could work.

Using "common" instead of "cut", and thus without the additional "outside wire", could be an optimisation in the case of "Symmetric to plane" and "Thought all" are set for Pocket. Or if the revolution angle is 360° for Groove. No idea whether it's worth the effort, though.

For the subtractive Loft and Sweep work, we may also have the two use cases of "remove outside" (only in the H/V direction of the sketch) and "enveloping" (removing the outside also in the sketches normal direction, i.e. boolean common).

The subtractive primitives may only need the enveloping.

For Hole and Subtractive Helix I see no sensible use case of either, "remove outside" and "enveloping". (Ironically, the subtractive helix has implemented such an enveloping, calls it "Outside" and implements it using boolean common.)

Recently, I was in the need for such an "enveloping groove" quite often. Is someone currently working on this?
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: #4828 PartDesign: inverse for pocket

Post by TheMarkster »

jonasb wrote: Wed Jan 05, 2022 3:47 pm
As a potential "Remove Outside" property for PartDesign's Pocket and Groove operation does not need to be as universal as your wire filter, calculating this "outside wire" based on the base feature's bounding box could work.
Possibly it could work to use the BoundBox. My initial concern would be in cases where the sketch normal is not orthogonal to a base plane, but I haven't thought it through.

Using "common" instead of "cut", and thus without the additional "outside wire", could be an optimisation in the case of "Symmetric to plane" and "Thought all" are set for Pocket. Or if the revolution angle is 360° for Groove. No idea whether it's worth the effort, though.

For the subtractive Loft and Sweep work, we may also have the two use cases of "remove outside" (only in the H/V direction of the sketch) and "enveloping" (removing the outside also in the sketches normal direction, i.e. boolean common).
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.

The subtractive primitives may only need the enveloping.

For Hole and Subtractive Helix I see no sensible use case of either, "remove outside" and "enveloping". (Ironically, the subtractive helix has implemented such an enveloping, calls it "Outside" and implements it using boolean common.)

Recently, I was in the need for such an "enveloping groove" quite often. Is someone currently working on this?
Another option to consider is another macro I have called PDWrapper. With it one can essentially convert a subtractive (or additive) feature to a common feature. It has the same problems with pattern tools as mentioned above, but being a different animal different behavior is to be expected, unlike where we replace the cut with a common in a pocket operation. Consider this model with a subtractive groove:
Snip macro screenshot-7ede11.png
Snip macro screenshot-7ede11.png (68.84 KiB) Viewed 4957 times
and after converting the groove to a common additive:
Snip macro screenshot-d6cf3f.png
Snip macro screenshot-d6cf3f.png (69.95 KiB) Viewed 4957 times
In the edit placement adjustments dialog one can toggle the tip tool, tip base, and tip shape objects, color coded:
Snip macro screenshot-15d77e.png
Snip macro screenshot-15d77e.png (87.74 KiB) Viewed 4957 times
PDWrapper is a beastly macro, quite powerful, and even more complicated to use. But with great power comes great complexity. I plan to make a video to document its use, but it will probably take several videos.

Install PDWrapper and run it to create the pdwrapper.py file before opening the attached file.
pdwrapper_common_groove_example.FCStd
(14.28 KiB) Downloaded 76 times
Post Reply