boolean cut off a piece of M30*1.5 threaded rod

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
triplus
Veteran
Posts: 9472
Joined: Mon Dec 12, 2011 4:45 pm

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by triplus »

@tanderson69

Doing a single revolution will only get the user to make one (or more) revolution successfully. But resulting solid will not allow the user to do much with it (boolean operations). It will fail at first boolean operation like fusing it with cylinder or at second when cutting that out of for example a box.

I tried a few things but ATM i would say users won't succeed by modeling "threaded rod" and after trying to use that for cutting out the inner thread from solid.

On your image look at the inner face of the first revolution. This face and outer face of for example cylinder will never form "perfect face" after boolean operation and instead a lot of artifacts will corrupt it.

Until this gets resolved (geometric kernel or in FreeCAD tools) i don't think users should try to do this task in the first place as it won't work. I am wondering if some internal tolerance could be tweaked to get that "perfect face" after boolean. Maybe fuzzy boolean parameter avaliable in the future could help. As for the current possibilities from my point of view i will continue here:

viewtopic.php?f=3&t=12593
User avatar
tanderson69
Veteran
Posts: 1624
Joined: Thu Feb 18, 2010 1:07 am

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by tanderson69 »

triplus wrote:Doing a single revolution will only get the user to make one (or more) revolution successfully.
What does this sentence even mean?

I didn't say I had all the answers. I was simply pointing out why that modeling operation won't work. I think a free-form(surface) approach is better suited. I have successfully made some threads, but it is always hit and miss and not easy.

thread.png
thread.png (110.74 KiB) Viewed 2483 times
triplus
Veteran
Posts: 9472
Joined: Mon Dec 12, 2011 4:45 pm

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by triplus »

tanderson69 wrote:What does this sentence even mean?
ATM FreeCAD enables the end user to only produce the thread itself (solid). Going beyond that (additional boolean operation including this solid) will most likely fail.
I didn't say I had all the answers. I was simply pointing out why that modeling operation won't work. I think a free-form(surface) approach is better suited.
I know and i am sorry if it sounded like that. You made a good introduction on the subject (from what usually works) and i went from that point on. As for using other approaches i am not sure if the resulting solid would be any more successful in boolean operations used after.

And standard procedure to make threads is to first create 2D profile on a mayor plane. I could be wrong but based on my experiments ATM that is more of an miss (going beyond the created thread solid).
I have successfully made some threads, but it is always hit and miss and not easy.
Exactly.
User avatar
tanderson69
Veteran
Posts: 1624
Joined: Thu Feb 18, 2010 1:07 am

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by tanderson69 »

triplus wrote:ATM FreeCAD enables the end user to only produce the thread itself (solid). Going beyond that (additional boolean operation including this solid) will most likely fail.
It all depends. You just have to try it. Having pretty good luck with this one today.
cut.png
cut.png (50.45 KiB) Viewed 2480 times
Attachments
M28M30_ta5.FCStd
(416.07 KiB) Downloaded 42 times
triplus
Veteran
Posts: 9472
Joined: Mon Dec 12, 2011 4:45 pm

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by triplus »

Yes that seems to produce a solid that can be used in boolean operation successfully. I am not sure why Common works the way it does as i would expect it would return threads only?

You used different modeling technique that avoids creating one issue that i do believe prevents FreeCAD users to create threads directly:

I used: Based on my observation this is (one of the) culprit(s) causing issues:
Example.png
Example.png (47.74 KiB) Viewed 2474 times
  • Helix
  • Sketch Line
  • Sweep
  • Face of the Cylinder (Draft Downgrade)
Until this two surfaces can be used in boolean operations directly and successfully FreeCAD users won't be able to make threads directly and successfully.
CorruptedSurface.png
CorruptedSurface.png (37.12 KiB) Viewed 2474 times
Therefore what would be interesting to know:

Is geometric kernel capable to achieve that task or not ATM (on first image Cut is used on second Common)? Could this be tested somehow without involving FreeCAD?

What leads me to believe this could be some internal tolerance (FreeCAD/OCC) issue is i got this result when using 100 nm as boolean tolerance:
Fuzzy.png
Fuzzy.png (29.34 KiB) Viewed 2474 times
Almost perfect.
triplus
Veteran
Posts: 9472
Joined: Mon Dec 12, 2011 4:45 pm

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by triplus »

OK i read this:

viewtopic.php?f=3&t=12593#p101110
Rule 2. Remember that helix in FreeCAD is an imprecise thing. As a consequence, a cylinder made to mate with the thread precisely is very likely to fail to fuse to the thread. In general, avoid geometry coincident to elements of the sweep, such as tangent faces, edges tangent to faces they are not connected to, coincident and tangent edges, etc.
Therefore the reason why ATM users can't make threads (as we have discussed) directly in FreeCAD actually could be related to precision? More precisely helix precision? After i searched the forum and found this:

viewtopic.php?f=10&t=6355

Was the default tolerance changed to tolerance of 1e-7 instead of 1e-5? I am guessing it did? That would explain why i get the best result when i set boolean fuzzy tolerance to value 1e-7 (100 nm)?

What is default tolerance for sweep and boolean operations in FreeCAD?
User avatar
tanderson69
Veteran
Posts: 1624
Joined: Thu Feb 18, 2010 1:07 am

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by tanderson69 »

triplus wrote:Yes that seems to produce a solid that can be used in boolean operation successfully. I am not sure why Common works the way it does as i would expect it would return threads only?
That is the "trick" for this method. Shape001 is what is call a "half space". I made it with the following python code:

Code: Select all

temp = App.ActiveDocument.Shell.Shape.copy()
halfSpace = temp.makeHalfSpace(FreeCAD.Vector(0.0, 0.0, 0.0))
Part.show(halfSpace)
Run Shape001 through the check geometry and you can see it is an invalid solid with an open shell. The booleans will work with a half space as long as the intersection of the 2 shapes doesn't involve any of the shells open wires.
halfSpace.png
halfSpace.png (154.95 KiB) Viewed 2458 times
Another thing that I think helps is the sweep having both a start and finish profile. I believe that this helps the sweep terminate at a position close enough to sew the next copy..... I just proved this out. look at the following 2 pictures. 1 picture is using 1 profile(just at beginning) and the other is using a profile at the start and end. You can see by the numbers that the distance measurement using 2 profiles is much closer.
1 profile.png
1 profile.png (65.29 KiB) Viewed 2458 times
2 profile.png
2 profile.png (56.14 KiB) Viewed 2458 times
triplus
Veteran
Posts: 9472
Joined: Mon Dec 12, 2011 4:45 pm

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by triplus »

Thanks for the explanation and i was thinking in this direction indeed as i remembered similar use case presented in "half space" debate. Anyway if it produces valid solid with threads and it can be after used in boolean operations it has my vote.

I still didn't give up on FreeCAD providing the user possibility to model the solid with threads directly and after to use it in boolean operation successfully. I can't fix that but i can provide a clue and hopefully things would evolve from there on. I think i found something worth "reporting" but need to do some tests first.
triplus
Veteran
Posts: 9472
Joined: Mon Dec 12, 2011 4:45 pm

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by triplus »

OK here it is. This was made on FreeCAD installed from Ubuntu Daily PPA:
  • Insert Helix and use Part Extrude on it (Z direction 0,2 mm).
  • Insert Cylinder and use Draft Downgrade tool on it to get a face.
  • Select them and use Boolean Cut.
PerfectCut.png
PerfectCut.png (30.08 KiB) Viewed 2446 times
Perfect Cut!

If different approach is used or combination with the following objects:
  • Create sketch with circle as 2D profile and use Part Extrude on it. And use that instead of Draft Downgrade face.
  • Use Part Sweep with a line as 2D profile instead of using Part Extrude directly on helix.
Boolean Cut will fail.

Therefore this does not necessarily indicate geometric kernel can make perfect threads when using direct modeling approach but in my opinion this is encouraging and a good start.

Therefore:
  • Boolean Cut can succeed
  • Geometric kernel can produce correct result
  • Helix precision by itself doesn't prevent Boolean Cut to succeed
Therefore my conclusion would be this in the end is FreeCAD precision issue and it needs to be resolved in FreeCAD.

Different objects like mentioned:
  • Draft Downgraded Cylinder Face
  • Extruded sketch based face
  • Face made by using extrude tool on helix directly
  • Sweeping the line and using helix as a path
  • Boolean operation
  • ...
Somebody with in-depth tolerance understanding in FreeCAD should probably check what to fix in FreeCAD to make this work better. Not only for the first boolean operation but the follow-up too. If not possible expose the tolerances to end user to set them accordingly in specific use cases. This issue is the closest i could find therefore i would say it was already reported:

issue #0001739

P.S. And thinking about this further we probably often pinpointed boolean operations as the main reason for something to not work but instead objects made with sweep operations are very likely contributing to the issue (or at least in some use cases).
User avatar
tanderson69
Veteran
Posts: 1624
Joined: Thu Feb 18, 2010 1:07 am

Re: boolean cut off a piece of M30*1.5 threaded rod

Post by tanderson69 »

triplus wrote:OK here it is.
Nice test!

triplus wrote: Perfect Cut!

If different approach is used or combination with the following objects:
  • Create sketch with circle as 2D profile and use Part Extrude on it. And use that instead of Draft Downgrade face.
  • Use Part Sweep with a line as 2D profile instead of using Part Extrude directly on helix.
Boolean Cut will fail.
Can confirm your 'Perfect Cut' base case. CAN'T confirm the substitution of padded circle for cylinder face. It still works here. Can confirm substituting swept line for extruded helix does cause failure.

triplus wrote:Therefore:

[*]Helix precision by itself doesn't prevent Boolean Cut to succeed[/list]
I agree with this. Nice job! Boolean algorithms are not supported for non-solid objects, but I think we are safe to draw conclusions here.

triplus wrote:Therefore my conclusion would be this in the end is FreeCAD precision issue and it needs to be resolved in FreeCAD.
Here is where you lost me. For me, the results of this test show the consistency of extrude vs sweep. What I am thinking, is the approximation of the spline helix combined with the freenet calculation is causing tiny oscillations (twisting if you will) of the profile geometry as it is swept along the spline. This causes the edges to the newly created face to go in and out of the face. Here is a picture of my boolean result here and you can see internal edges created through-out the face. What we need here is a deviation analysis tool to run on the edges to the face.
InternalEdges.png
InternalEdges.png (37.46 KiB) Viewed 2437 times
Post Reply