True threads in PartDesign-Hole, how to give users the best experience?

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

True threads in PartDesign-Hole, how to give users the best experience?

Post by davidosterberg »

Hi all,

True thread generation has long existed in the UI for the PartDesign -> Hole tool. It has been hidden because the implementation was missing in the backend.

In this PR https://github.com/FreeCAD/FreeCAD/pull/4274 I add true thread support to the tool
both_direction_demo.png
both_direction_demo.png (117.62 KiB) Viewed 3900 times
I think the primary users of this functionality will be the 3D printing community, as it allows easy printing of threaded holes. But when printing threads it is usually needed to account for the low resolution of the 3D printer by adding some clearance in the thread (say +0.1 mm). Currently there is the thread class, where the user can specify a G tolerance class and get a little clearance. But the clearance is still too tight good results when 3D printing.

I would like to add support for larger clearance in the UI, while at the same time maintaining the professional look that the dialog have now.

Please give your advice on how it shall be done.
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: True threads in PartDesign-Hole, how to give users the best experience?

Post by hyarion »

It looks awesome!

I haven't had the pleasure to test it yet, I have just skimmed through the code.
Some questions, thoughts and ideas:
1. I thought the implementation would be longer, well done :)
2. Regarding clearance, how about adding a new item "custom" in the drop down list which creates an input field where you can specify the clearance manually? (and remove the item if something other than custom is selected)
3. Would it be possible to add support for creating treads with multiple starts? Like nuts for lead screws, see: https://www.thomsonlinear.com/en/suppor ... h-and-lead
4. I think you could change "Model Actual Thread" to "Model Thread"
5. Would it be possible to add a dynamic property in the document object to override the "model thread"? This way it would be possible to turn off all modelled threads to speed up prototyping and turn them back on when when you want export.
6. May I wish for a Thread Tool, which can create both internal and external threads, next? ;)
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: True threads in PartDesign-Hole, how to give users the best experience?

Post by davidosterberg »

hyarion wrote: Mon Jan 11, 2021 9:11 pm 2. Regarding clearance, how about adding a new item "custom" in the drop down list which creates an input field where you can specify the clearance
In the dropdown for thread class? It is tempting to use the dropdown called clearance, but that is actually used for hole-bolt clearance in unthreaded holes.
I don't consider it natural to specify the custom clearance in a dropdown called Thread class.

I ended up doing this (note how thread class becomes disabled):
custom_clearance_sluggish.gif
custom_clearance_sluggish.gif (274.39 KiB) Viewed 3813 times
this is also a good example of the sluggishness of the model when you have multiple threaded holes. I may need a "update view" checkbox also.
hyarion wrote: Mon Jan 11, 2021 9:11 pm 3. Would it be possible to add support for creating treads with multiple starts? Like nuts for lead screws, see: https://www.thomsonlinear.com/en/suppor ... h-and-lead
Certainly possible, although that would somewhat extend the scope of the hole tool. Such an extension should be discussed separately. Personally I think that is a bit of a special task to make such a nut. It would be acceptable to me to make it manually with the Helix tool and a rotational pattern.
hyarion wrote: Mon Jan 11, 2021 9:11 pm 4. I think you could change "Model Actual Thread" to "Model Thread"
I agree
hyarion wrote: Mon Jan 11, 2021 9:11 pm 5. Would it be possible to add a dynamic property in the document object to override the "model thread"? This way it would be possible to turn off all modelled threads to speed up prototyping and turn them back on when when you want export.
Although a cool idea, I don't think that can be done until the Topological Naming Problem has been solved.
hyarion wrote: Mon Jan 11, 2021 9:11 pm 6. May I wish for a Thread Tool, which can create both internal and external threads, next? ;)
No promises, but maybe.
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: True threads in PartDesign-Hole, how to give users the best experience?

Post by hyarion »

davidosterberg wrote: Mon Jan 11, 2021 11:53 pm
hyarion wrote: Mon Jan 11, 2021 9:11 pm 2. Regarding clearance, how about adding a new item "custom" in the drop down list which creates an input field where you can specify the clearance
In the dropdown for thread class? It is tempting to use the dropdown called clearance, but that is actually used for hole-bolt clearance in unthreaded holes.
I don't consider it natural to specify the custom clearance in a dropdown called Thread class.

I ended up doing this (note how thread class becomes disabled):
custom_clearance_sluggish.gif
I meant in the Clearance drop down list on the right with Standard/Close/Wide options but I notice that's greyed out when Threaded isn't selected, so maybe we could just change it to Thread Clearance when the Threaded option is selected instead?
davidosterberg wrote: Mon Jan 11, 2021 11:53 pm
hyarion wrote: Mon Jan 11, 2021 9:11 pm 3. Would it be possible to add support for creating treads with multiple starts? Like nuts for lead screws, see: https://www.thomsonlinear.com/en/suppor ... h-and-lead
Certainly possible, although that would somewhat extend the scope of the hole tool. Such an extension should be discussed separately. Personally I think that is a bit of a special task to make such a nut. It would be acceptable to me to make it manually with the Helix tool and a rotational pattern.
Yeah maybe it's a bit overkill for this tool. Helix tool or maybe including it in a later threading tool would be better.
davidosterberg wrote: Mon Jan 11, 2021 11:53 pm
hyarion wrote: Mon Jan 11, 2021 9:11 pm 5. Would it be possible to add a dynamic property in the document object to override the "model thread"? This way it would be possible to turn off all modelled threads to speed up prototyping and turn them back on when when you want export.
Although a cool idea, I don't think that can be done until the Topological Naming Problem has been solved.
I don't see the problem, the option would just operate on the document item level, not depend on OCCT generated geometry.
Pseudo code for a change like that could be:

Code: Select all

if document property OverrideModelThread has changed:
    foreach item in documentTree:
        if item is holeFeature and item.ModelThread:
            item.touch()
    activeDocument.recompute()
and then when a hole feature is recomputed it would look at the document for the property OverrideModelThread to see if it should model the thread or not.
But this could be a later addition.

Anyway, most of this is just minor ui changes and isn't really needed at the start.


Another question:
Why isn't the threads all the way down to the bottom of the holes in your example? (Bottoming taps should get closer to the full length, https://makezine.com/2017/03/16/tapping-and-threading/)
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: True threads in PartDesign-Hole, how to give users the best experience?

Post by davidosterberg »

hyarion wrote: Tue Jan 12, 2021 1:09 am I meant in the Clearance drop down list on the right with Standard/Close/Wide options but I notice that's greyed out when Threaded isn't selected, so maybe we could just change it to Thread Clearance when the Threaded option is selected instead?
Hmm, not convinced. I think it is important to emphasize in the UI that Thread class is the standard way to specifying the clearance in the thread. The custom clearance is not standardized and it is a convenience feature for the 3D printing folks. I think I am quite happy with the setting in the Misc section.
hyarion wrote: Tue Jan 12, 2021 1:09 am I don't see the problem, the option would just operate on the document item level, not depend on OCCT generated geometry.
Pseudo code for a change like that could be:

Code: Select all

if document property OverrideModelThread has changed:
    foreach item in documentTree:
        if item is holeFeature and item.ModelThread:
            item.touch()
    activeDocument.recompute()
and then when a hole feature is recomputed it would look at the document for the property OverrideModelThread to see if it should model the thread or not.
But this could be a later addition.
I don't know enought to say if it is feasible. I was thinking that if the thread is not modeled, and then other features build upon the unmodeled geometry. Then what is to say that the thread can be applied later (the support faces etc might have new names by then).
hyarion wrote: Tue Jan 12, 2021 1:09 am Why isn't the threads all the way down to the bottom of the holes in your example? (Bottoming taps should get closer to the full length, https://makezine.com/2017/03/16/tapping-and-threading/)
Yes, this is just a guess for now. I know in reality it is not possible to tap all the way to the bottom. Of course 3d printers dont care about that, and perhaps modern taps are better than old taps and so on. A default based on best practice must be determined. And perhaps there needs to be a way to specify the thread length.
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: True threads in PartDesign-Hole, how to give users the best experience?

Post by chrisb »

This post was hanging around in a browser tab, I post it anyway ...
---------------------------------------------
This will be a great addition, thanks for tackling it!

Threads are known to slow down recomputing times significantly. I would like to see an expression aware switch for using vs. not using the threads. That would enable one central place where they could be switched on and off.

I would appreciate it, if 3D printing adjustments could be handled independently from the clearance, because it would enable to use the same model for 3D prototype printing and for machining.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: True threads in PartDesign-Hole, how to give users the best experience?

Post by davidosterberg »

chrisb wrote: Tue Jan 12, 2021 9:36 pm Threads are known to slow down recomputing times significantly. I would like to see an expression aware switch for using vs. not using the threads. That would enable one central place where they could be switched on and off.
That would be neat. I have not seen expression aware "true/false" properties. Do you know of a feature that has one?
chrisb wrote: Tue Jan 12, 2021 9:36 pm I would appreciate it, if 3D printing adjustments could be handled independently from the clearance, because it would enable to use the same model for 3D prototype printing and for machining.
Switching between modelled and unmodelled threads will be easy as long as your model is not sensitive to the TNP. Currently it will only apply the Custom thread clearance if the Model thread option is active.
Attachments
properties.png
properties.png (62.23 KiB) Viewed 3633 times
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: True threads in PartDesign-Hole, how to give users the best experience?

Post by hyarion »

davidosterberg wrote: Tue Jan 12, 2021 7:36 am
hyarion wrote: Tue Jan 12, 2021 1:09 am [..]maybe we could just change it to Thread Clearance when the Threaded option is selected instead?
Hmm, not convinced. I think it is important to emphasize in the UI that Thread class is the standard way to specifying the clearance in the thread. The custom clearance is not standardized and it is a convenience feature for the 3D printing folks. I think I am quite happy with the setting in the Misc section.
Sure, misc works for now and it can be changed afterwards if ever needed.
davidosterberg wrote: Tue Jan 12, 2021 7:36 am
hyarion wrote: Tue Jan 12, 2021 1:09 am Why isn't the threads all the way down to the bottom of the holes in your example? (Bottoming taps should get closer to the full length, https://makezine.com/2017/03/16/tapping-and-threading/)
Yes, this is just a guess for now. I know in reality it is not possible to tap all the way to the bottom. Of course 3d printers dont care about that, and perhaps modern taps are better than old taps and so on. A default based on best practice must be determined. And perhaps there needs to be a way to specify the thread length.
In my opinion the default value should be fully threaded (It is possible to machine it, though seldom worth the trouble), this is also the case in other software I've used. If not fully threaded would be default, which value would?
user1234
Veteran
Posts: 3261
Joined: Mon Jul 11, 2016 5:08 pm

Re: True threads in PartDesign-Hole, how to give users the best experience?

Post by user1234 »

Hello!
chrisb wrote: Tue Jan 12, 2021 9:36 pmI would appreciate it, if 3D printing adjustments could be handled independently from the clearance, because it would enable to use the same model for 3D prototype printing and for machining.
+1, because not everyone use CAD for printing, i would say the most people do not use it for printing. And different clearance in the 3D model will disturb 2D derivatives (or in CAM (Path)).
davidosterberg wrote: Tue Jan 12, 2021 7:36 amAnd perhaps there needs to be a way to specify the thread length.
+1, yes this is an essential feature, which is missing.

Just in case, here suggestion how a thread should be represented in 3D for a simplified view, like in the mechanical engineering. I think that can be used also for 2D derivatives. Do not be forced to do something in this direction, this is just information.
https://forum.freecadweb.org/viewtopic. ... 6&start=10

Thanks for working on it.

Greetings
user1234
Post Reply