PartDesign Hole: read cut-types from json-files.

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53924
Joined: Tue Mar 17, 2015 9:14 am

Re: PartDesign Hole: read cut-types from json-files.

Post by chrisb »

I wait for it!
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: PartDesign Hole: read cut-types from json-files.

Post by davidosterberg »

Would this also be the way to store actual thread cross section parameters. I.e what we need in order to produce the real thread geometry (when that feature has been implemented)?
rynn
Posts: 454
Joined: Tue Jul 31, 2018 7:00 am

Re: PartDesign Hole: read cut-types from json-files.

Post by rynn »

davidosterberg wrote: Tue Dec 29, 2020 10:48 pm Would this also be the way to store actual thread cross section parameters. I.e what we need in order to produce the real thread geometry (when that feature has been implemented)?
Probably. In my opinion JSON is a good compromise between beeing structured and beeing human-readable/human-editable. There are other fileformats like XML, csv/tsv or YAML which are either more structured, more human-readable or easier to edit.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: PartDesign Hole: read cut-types from json-files.

Post by davidosterberg »

rynn wrote: Wed Dec 30, 2020 11:54 am
davidosterberg wrote: Tue Dec 29, 2020 10:48 pm Would this also be the way to store actual thread cross section parameters. I.e what we need in order to produce the real thread geometry (when that feature has been implemented)?
Probably. In my opinion JSON is a good compromise between beeing structured and beeing human-readable/human-editable. There are other fileformats like XML, csv/tsv or YAML which are either more structured, more human-readable or easier to edit.
Great! Do you know if somebody else is working on the true threads implementation?

I have been recently been working on something similar (https://github.com/FreeCAD/FreeCAD/pull/4209), and implementing the hole feature's true thread function has been on my todo list.

But in order to do it we need to agree on how to store and maintain the database of cross sections dimensions (all the parameters). It would be tempting to somehow use sketches to draw the cross sections with constraints for each thread family, and use JSON to store the dimensional values. This way it would be easy to implement new thread types. Not sure how to implement it though.
rynn
Posts: 454
Joined: Tue Jul 31, 2018 7:00 am

Re: PartDesign Hole: read cut-types from json-files.

Post by rynn »

davidosterberg wrote: Wed Dec 30, 2020 12:50 pm Great! Do you know if somebody else is working on the true threads implementation?
I don’t know, but I do not have an overview at all. Maybe ask wmayer or uwestoehr
I have been recently been working on something similar (https://github.com/FreeCAD/FreeCAD/pull/4209), and implementing the hole feature's true thread function has been on my todo list.
Interesting feature

There are at least two ways to generate threads. For a vertical thread:
  1. sweep a vertical cross-section of one tooth along a helix or
  2. sweep a horizontal crossection of the thread along a helix (see ThreadProfile workbench¹).
In my understanding the later method is favorable.
There is also thread-generation in the fasteners-workbench² (don’t know how it’s working).
But in order to do it we need to agree on how to store and maintain the database of cross sections dimensions (all the parameters). It would be tempting to somehow use sketches to draw the cross sections with constraints for each thread family, and use JSON to store the dimensional values. This way it would be easy to implement new thread types. Not sure how to implement it though.
The hard part probably is implementing the thread creation, putting the parameters in JSON-files is straightforward then.
__________
¹ https://github.com/mwganson/ThreadProfile
² https://github.com/shaise/FreeCAD_FastenersWB
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: PartDesign Hole: read cut-types from json-files.

Post by davidosterberg »

rynn wrote: Thu Dec 31, 2020 11:49 am There are at least two ways to generate threads. For a vertical thread:
  1. sweep a vertical cross-section of one tooth along a helix or
  2. sweep a horizontal crossection of the thread along a helix (see ThreadProfile workbench¹).
In my understanding the later method is favorable.
There is an overview in https://wiki.freecadweb.org/Thread_for_Screw_Tutorial that covers both these methods. I like Method 3 (the former in your list). because it is straight forward to define and verify the profile against the defining standard. You can also implement stuff like thread tolerance, so that the user can tweak that to his liking (important for 3D printing).

rynn wrote: Thu Dec 31, 2020 11:49 am The hard part probably is implementing the thread creation, putting the parameters in JSON-files is straightforward then.
Not hard. The functionality is there in above mentioned PR. It could do both the sweep methods you mention.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: PartDesign Hole: read cut-types from json-files.

Post by davidosterberg »

Sneak peak of upcoming PR:
sneek_peek.gif
sneek_peek.gif (585.07 KiB) Viewed 1590 times
What works:
- Metric coarse thread is implemented
- Left / Right thread direction

Todo:
- Thread modeling is pretty slow, so perhaps give some visual indication that FreeCAD is thinking.
- Implement UNC
- Perhaps some refactoring
- Perhaps thread lead out
- Tolerance adjustment (including convenience functions for 3d printing)
chrisb
Veteran
Posts: 53924
Joined: Tue Mar 17, 2015 9:14 am

Re: PartDesign Hole: read cut-types from json-files.

Post by chrisb »

From the images it looks as if you mixed left and right hand threads.
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: PartDesign Hole: read cut-types from json-files.

Post by davidosterberg »

chrisb wrote: Mon Jan 11, 2021 9:27 pm From the images it looks as if you mixed left and right hand threads.
I don't think so (but doing this kind of error is my specialty so you never know). Maybe it is a perspective thing?
perspective.png
perspective.png (42.66 KiB) Viewed 1517 times

The threads being generated in the picture are the fine pitched ones to the left and they are left handed. The coarse pitched ones are right handed (i believe).

You might want to move this conversation to the other thread. I only cross posted here to attract the attention of some of the stakeholders/maintainers of this tool.
Post Reply