martinproks / cosmeticthread3d

FreeCAD tool - cosmetic thread for 3D geometry - experimental
GNU Lesser General Public License v2.1
4 stars 0 forks source link

Parameters of threads - Metric + non metric #19

Open martinproks opened 8 months ago

martinproks commented 8 months ago

I need to open discussion about parameters on the CosmeticThread3D in FreeCAD. These parameters make interface for other modules as TechDraw or CNCpath. The parameters are source of data and changes of the parameters in a future could have impacts to the modules. It is good to set the parameters as good as possible now at the beginning.

There are 4 types of parameters at Cosmetic thread

  1. Attachment parameteres. This group is mandatory, no need to discuss about.
  2. Base parameters (exclude Description). This group is mandatory, no need to discuss about.
  3. Base parameter Description. Is it necessary? At this moment the function is creating this parameter and fill it by selected thread mark. This is not necessary, but I think it is good to have variable with thread mark. (Label and object Name are modified by FreeCAD, there is no sure about the value.)
  4. ct3d_data group. This is necessary to discuss about. This group content differs for internal and external threads.

Internal thread:

External thread, similar as for internal:

These parameters are for metric threads. I do not know terminology for whitworth, US threads, trapezoidal threads, pipe threads (G), ... Are these parameters usable for them too?

pierreporte commented 7 months ago

Your comments are very sound in general.

I would confirm that the length tolerance and roughness are not that useful in the design stage. In fact, I don’t know a single program that allow to set these parameters in their thread UI. They are always manually added in drawings. In CAM, it must be the same but someone more experienced like @sliptonic may be able to answer.

I beg to differ about the pitch. It is absolutely necessary. Non coarse threads are required to show the thread length. For example, “M8” alone always mean 1.25 mm pitch. For fine threads or custom pitches (say 0.5 mm), the dimension in the drawing must be “M8×0.5”. Imperial threads (UNC, UNF, etc.) always have the value in the dimension. Note that the pitch of imperial threads is defined indirectly using the number of threads per inch (TPI).

Two new parameters could be useful:

The impact of these would be limited to the 3D model. They would need #9 to be fixed. They are certainly out of scope of the current work.

For the threads length, it should be something similar to pads and pockets: dimension, up to something, through. You could argue that there should also be a parameter for the starting point (in case the threads doesn’t start at the attachment edge—this is a use case I had at my job recently for hydraulic fittings).

Also there are special threads types that are basically identical to normal ones but there is a slight fillet in the thread groove. They look identical in 3D and drawings, except the J added to the designation: “MJ” instead of “M”, “UNJF” instead of “UNF” and so on.

martinproks commented 7 months ago

Hi,

There are 4 groups of prolems I think:

  1. Thread tolerance, length tolerance and roughness. This parameters are not necessary to fill. It could be empty. But if the user fill it at design phase, it could be benefit to TexDraw and CAM. But this is at edge of PMI approach... Yeas, it could be great if someone from CAM world tell if it could be benefit for it or not.

  2. "Beg for pitch differ". I do not catch what exactly do you means for implementation. Try version from (edit) yesterday, there are Coarse and Fine metric threads implemented. The pitch parameter is decimal value in the metric thread meaning - pitch per one turn. I'm looking to US threads at https://en.wikipedia.org/wiki/Unified_Thread_Standard (english version) and they are using different terminology from Metric world. 'Dmaj', 'd' as TPI, but pitch is pitch or 'p'. May be it could be good idea to add parameter 'TPI'. This parameter could be calculated from pitch for metric threads. W or UN threads could have TPI value exact and pitch calculated from it... Is this what did you mean?

  3. a. Automatic chamfer and undercut. This is more related to hole/rod real geometry, not to cosmetic thread I think.

  4. b. Similar if the thread is not starting at edge of hole/rod, but in some depth - as you mentioned for hydraulics. Examples: http://www.hydraulicsdirect.com/v/vspfiles/assets/images/drawing_JIC-37-Flare.jpg https://summit-hydraulics.com/wp-content/uploads/2017/05/HM4-Left-800x800.jpg Again, I think the hole profile (or rod profile) should be modeled and just the thread itself should be cosmetic/symbolic/fake. See attachment here - just picture from hand... advanced-geometry-of-threaded-parts

  5. Special thread types - it will be just another group of threads I think...

pierreporte commented 7 months ago
  1. I like this. When it’s implemented as a task panel, it can be put in an “advanced” section or something similar.
  2. I think we mean the same thing. The dual entry is a good idea. With a radio button to select the editable field, the other one updates automatically.
  3. The idea is that cosmetic threads is not the important feature. What counts is that the part is threaded, and threading a part leads to this sort of accessory features. In the future, there could be an option to make the thread either cosmetic or real with a checkbox. The current hole wizard is like this (but it lacks cosmetic threads—hopefully your feature will be integrated into it for internal threads).
  4. Yes, hydraulic fittings were the idea behind the remark (namely 37° JIC, which is one of your examples).
  5. For J-type threads, I think that a checkbox can do the job. Everything is the same as normal threads, just the groove that has a larger fillet inside. The only visual difference for cosmetic threads is the J letter in drawings.

By the way, I can’t make the add-on work using the latest weekly version of FreeCAD (from April 9) and your code at 3805fa650fbbd6e143b9206a1bbfce3a85d791d6. Here is what the report view say:

Report view traceback ``` 14:39:29 pyException: Traceback (most recent call last): File "/tmp/.mount_FreeCA9PQVXj/usr/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py", line 330, in accept self.callback_OK() File "/home/thomas/.local/share/FreeCAD/Mod/CosmeticThread3D/cosmeticthread3d_Gui.py", line 278, in eA_ok D_shaft = ct3dGuiTools.diameter_from_attachment(self.obj_tmp) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/thomas/.local/share/FreeCAD/Mod/CosmeticThread3D/ct3dGuiTools.py", line 589, in diameter_from_attachment for feature, subs in obj.Support: ^^^^^^^^^^^ : 'PrimitivePy' object has no attribute 'Support' ```

Same result whatever I try (Part objects, Part Design objects). Your examples load fine though.

martinproks commented 7 months ago

Hi,

First thanks to report problem in weekly builds. It is fixed now in today's pull, You can test it.

  1. Move parameters to Advanced section on separate task panel. Yeas, it could be good idea. But I do not know how at this moment. May be in future when I realize how. My experiences in GUI programming are just basic, I start learn python 5 months ago and GUI 2 months ago...
  2. pitch vs. TPI. At this moment it is set. When you are working with metric threads, TPI is computed from pitch. If you are dealing with inch threads. TPI is set and pitch is calculated.
  3. I do not like the idea merge cosmetic thread with hole function or other functions like chamfers and so on. I do not agree with switch cosmetic/real thread. This is way the NX/UG is going. It leads to very complicated and complex tool that is longer than my monitor. Yeas the benefit is one feature, all about hole is done. But the tool is overloaded in my opinion and it must be nightmare to develop and maintain such type of tool with so many elements and combinations... I prefer more but simple tools. The cosmetic thread is complicated enough itself...
  4. OK
  5. Special/custom threads. J, L, or absolutely different threads. You can create some thread on the hole or rod. Once it exists, you can go to the properties tab and edit what you want. It is not comfort, but for now it is as it is. For future it could be good to have some kind of switch GUI - custom thread - and possibility to edit directly there. 2024-04-12_22-45-49
pierreporte commented 7 months ago

I understand your point about UI/UX. This is something that can be figured out later once the features are there. The FreeCAD Design Working Group (DWG) will be there to guide you. Once the PartDesign implementation, translation into drawings, and issue #9 are figured out, I will start working on it with the DWG because at this time your code could be viable for a pull request into main FreeCAD.