ThreadProfile Workbench

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

ThreadProfile Workbench

Post by TheMarkster »

https://github.com/mwganson/ThreadProfile

Now available to install in the addon manager, you should see ThreadProfile listed in the workbench tab. Full documentation is available at the above link. Thanks to yorik and Kunda1 for helping me with that.

The ThreadProfile workbench can be used to create a parametric 2d thread profile object compatible with both Part and Part Design workbenches. It looks like a circle, but it isn't. It is a cross section of a thread profile. When the thread profile is swept along a helix (which helix can be created in the ThreadProfile workbench) it creates the thread.

To use in Part Design just drag and drop the ThreadProfile object into the Body, just as you would drag and drop a sketch. You can then use the same operations you would use on a sketch. If you wish to make external threads you should use the Additive Pipe sweep. If you wish to make internal threads you should use the Subtractive Pipe to cut the threads out of another object, perhaps a padded hexagon. To use in Part workbench use the sweep tool. If it is an external thread you are done, but if it is internal you need to cut it out of some other object with a boolean cut.

So far, all of the threads I have produced with this (has not been so many) have passed Check Geometry with BOP check enabled.

Here is a demonstration video where I show it in both Part and Part Design.

phpBB [video]


The ThreadProfile object is basically a Draft BSpline with additional properties and capabilities. In fact, I used the Draft BSPline code as a starting point. As you can see in the video the performance leaves something to be desired. I have a Quality property you can use to speed things up some, at the expense of degraded quality of the thread profile. The default quality of 1 uses 720 points to produce the thread profile, 2 points per degree. If you change to quality = 2, it only uses 360, 3 uses 240, etc. Quality=12 would only use 60 points. I recommend leaving the default setting, but you experiment with it if you like.

If you create the helix in the workbench it will be parametrically linked to the ThreadProfile object. If you change the pitch in the ThreadProfile object the helix pitch will update with it. The helix height is linked to the ThreadProfile pitch and thread count properties. If you change the placement of the ThreadProfile object prior to creating the helix, the helix will inherit the ThreadProfile's placement, but this is not parametric. If you move the ThreadProfile you will have to also move the helix. If you create the helix in the part workbench it will not be linked parametrically at all.

Note: this uses the pitch and the minor diameter (not the nominal diameter). You need to look up the minor diameter for your thread. I don't have this automatically done at this time and probably never will. But I have a menu command to open a couple different online calculators (one for metric the other for ANSI) in your default web browser.

The same profile is used for both metric and inch sizes, which they're both basically the same 60 degree profile. The ANSI specification doesn't call for rounded roots, but it is permissible to have them, so I think there is no need for separate profiles. It is possible to add more profiles in the future, for example, I could add an ACME profile I think without so much difficulty.
Last edited by TheMarkster on Tue Aug 13, 2019 2:08 am, edited 1 time in total.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: ThreadProfile Workbench

Post by Kunda1 »

Fantastic!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: ThreadProfile Workbench

Post by chrisb »

This looks very interesting. May I ask why you use a B-spline? I can see in the thread profile only lines and arcs.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: ThreadProfile Workbench

Post by TheMarkster »

Kunda1 wrote: Tue Jul 23, 2019 1:52 pmFantastic!
Thanks. I have a pull request with the addons repo. Let me know if I need to do anything else with it.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: ThreadProfile Workbench

Post by TheMarkster »

chrisb wrote: Tue Jul 23, 2019 5:15 pm This looks very interesting. May I ask why you use a B-spline? I can see in the thread profile only lines and arcs.
The way it works is the ThreadProfile object has a varying, but very precisely constructed, radius. When it is swept along the helix in those places where the radius is unchanged from one point to the next along the ThreadProfile's outer edge is where you get a straight line along the crest of the thread. The angled lines and curves get produced as the ThreadProfile's outer edge radius changes from one point to the next. For example, if you sweep a circle along a helix you get a cylinder, just as if you had padded it instead, except the seamlines are different. The reason to use the bspline is to get a smooth transition from one radius to the next.

The ThreadProfile object is roughly equivalent to a cross section taken from an existing thread. It could be made by first sweeping a profile of the thread with the lines and arcs, then take the cross section of that sweep, but I thought it would be better performance to generate the profile mathematically.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: ThreadProfile Workbench

Post by chrisb »

I'm afraid I don't understand this now. I will retry tomorrow.

There is something else I'd like to propose: If I have an active body, the ThreadProfile should be generated directly inside of the body, e.g. like the SheetMetal workbench does it.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: ThreadProfile Workbench

Post by TheMarkster »

chrisb wrote: Wed Jul 24, 2019 12:00 am I'm afraid I don't understand this now. I will retry tomorrow.

There is something else I'd like to propose: If I have an active body, the ThreadProfile should be generated directly inside of the body, e.g. like the SheetMetal workbench does it.
Done in version 1.22.

Edit, now on version 1.23. If when the helix is created there is an active body a ShapeBinder will be created linking to the helix, and the helix will be hidden. Also, if there is an active Part container the helix goes into that. I hope it's not too much. I don't want to go too far with automation.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: ThreadProfile Workbench

Post by chrisb »

TheMarkster wrote: Wed Jul 24, 2019 1:53 am I don't want to go too far with automation.
+1. My praying!

Regarding microelly's work you could go a different way with similar objective: add another property, preferably expression aware, so that it can be controlled from one single place which changes the helix to a cylinder for ease of handling with faster display and simpler TechDraw views.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
bavariaSHAPE
Posts: 406
Joined: Tue Jun 10, 2014 8:31 am
Contact:

Re: ThreadProfile Workbench

Post by bavariaSHAPE »

Thank's, really great.

I can use it very well for 3D printing. Is there any chance of adding trapezoid and round threads at some point? These shapes are better for 3D printing.

I will publish a small clip about this Workbench on my YouTube channel with some explanations about threads.

:idea: Achim
… for a happy FreeCAD-World … JM2C …
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: ThreadProfile Workbench

Post by TheMarkster »

bavariaSHAPE wrote: Mon Jul 29, 2019 7:59 am Thank's, really great.

I can use it very well for 3D printing. Is there any chance of adding trapezoid and round threads at some point? These shapes are better for 3D printing.

I will publish a small clip about this Workbench on my YouTube channel with some explanations about threads.

:idea: Achim
Possibly. I want to add some more thread profile types. I'm looking at buttress threads. I think these could be ideal for 3d printing for a number of reasons. Because the angle is mostly in one direction there won't be much overhang. They are stronger, much stronger in one direction than in the other, which can be useful for plastic materials.
Locked