FreeCAD icon indicating copy to clipboard operation
FreeCAD copied to clipboard

[Feature] PartDesign: Add support for cosmetic threads (adding an option to fill a surface with image or other methods to mimic a thread-like shape)

Open FreeCAD-Bug-Importer opened this issue 3 years ago • 16 comments

Issue imported from https://tracker.freecad.org/view.php?id=1181

  • Reporter: project4
  • Date submitted: 7/14/2013

Original report text

I saw in other applications that it's common to fill the surface with an image that looks like a thread on parts. That simplifies the object since there will be much less details than modeling the threads on a bolt or nut.

Other ideas to use an image on a part is to apply a material on it. I think I saw somewhere that material is one of the big features for FreeCad, so I'm sure there will be much more work done in that direction, but the threading appearance is not related to that, so I hope you could add at least that property to the part designer.

Thanks.

Discussion from Mantis ticket

Comment by wmayer 2013-07-16 12:01

Do you talk about texture mapping?


Comment by project4 2013-07-16 15:19

Yes, I think that's how it's called. But I'm talking about one specific case for the threading and not every possible image to be used as a texture.


Comment by shoogen 2013-07-17 03:00

This could be useful for knurling as well.


Comment by ulrich1a 2013-07-30 06:04

There is a need to mark holes or bolts, which have a thread, in some way. Because if we want to have a drawing of a part with a thread, we also want the thread shown on the drawing with its characteristic drawing style. This method is named "cosmetic thread" in solidworks. It is shown for example at this page: http://help.solidworks.com/2013/English/SolidWorks/sldworks/c_cosmetic_threads.htm I think there should also a way to have this in a step file, but I could not find any useful information.


Comment by Kunda1 2021-02-20 22:45

davidosterberg how much does this ticket related to Helix ?

FreeCAD-Bug-Importer avatar Feb 07 '22 15:02 FreeCAD-Bug-Importer

New discussion respecting the developments since then, see https://forum.freecadweb.org/viewtopic.php?f=8&t=68646

chrisb-github avatar May 12 '22 21:05 chrisb-github

@PLChris do you mind updating this ticket with the more up-to-date issues that are wanted ?

luzpaz avatar Nov 07 '23 23:11 luzpaz

This issue should be called: “Add support for cosmetic threads”. This is an essential feature but, more importantly, it should be linked with the drawing. Also, a cosmetic thread should accept to have material removed afterwards and that should be shown in the drawing as well. This is essential for reliefs and mentioned in the forum thread.

Below is a comparison between Solid Edge and Alibre. They handle cosmetic threads a little bit differently but none of them get it perfect every time. Solid Edge is the best but Alibre has some nice perks while having terrible issues.

The second picture is from the forum and shows a good representation. It is good because it shows the thread pitch and has a color matching with the part. Other software (Solid Edge, Alibre, Solidworks) don’t change the color. This is very minor.

The cosmetic threads should have an option to be shown either like this (a nice representation with fake threads) or ever more simply to save computing time. It could be activated by users when they have a lot of bolts, nuts and other threaded parts. It would be acceptable to have only the simplistic representation instead of the texture.

The 3 most important points are:

  • users must be able to distinguish the threaded zones in the 3D view;
  • the cosmetic threads must be automatically inserted in the drawings;
  • materials removed from threads in 3D must not show anything in the drawing.

Of course everything should work for external and internal threads.

filetage

image

pierreporte avatar Nov 10 '23 15:11 pierreporte

Issue #5560 may be a prerequisite for some possible implementations of this feature.

pierreporte avatar Nov 13 '23 18:11 pierreporte

Thanks for the assist @pierreporte

luzpaz avatar Nov 13 '23 18:11 luzpaz

@martinproks is trying to solve this, first as a feature in the tree and 3D view. He acknowledges the need for the translation of cosmetic threads into drawings.

Repository: https://github.com/martinproks/cosmeticthread3d

Forum thread: https://forum.freecad.org/viewtopic.php?t=85047

pierreporte avatar Mar 05 '24 20:03 pierreporte

On top of cosmetic threads, there could be cosmetic knurling as well. Similarly, the precise representation need intensive computation and they appear in a simpler form in the drawings. There are several standards: DIN 82 and ISO 13444 in the metric world.

The most used are the axial and crossed 30° types. The depth can vary a lot but this should be left for the drawing.

In niche industries like horology, not only cylinders and planar surfaces are knurled: toroidal (convex and concave) and conical surfaces can be knurled as well. Knurling rollers are sold in a wide variety of shapes.

image

pierreporte avatar Mar 05 '24 20:03 pierreporte

Hi,

As @pierreporte wrote (thanks for link to this discussion), there is a git repository with Cosmetic Thread 3D WB (short nickname ct3d). My goal at this moment is explore and make more variants of ct3d, offer them to usage, test it in community and then select one or two methods for final implementation and more developement.

My idea is:

  • Make 3D representation of ct3d for usage in assemblies and in CNC path programming (easy visual detection of threaded holes and rods).
  • Attache additional information as "standardised" parameters usable for later technical drawings or CNC path programming.
  • Transfer ct3d information somehow into TechDraw.

At this moment, there is Part version of ct3d. It means, it is dedicated to work with 3D geometry based on Part WB. I'm working on improvements of UI at this moment and learning how to make PartDesign version with non-solid geometry. There is needed hack, I have some idea but I have to test it.

TechDraw is a problem now. Views can see and display shell geometry, but sections works just with solids. Threads disappears on sections at this moment. But this is wider TechDraw problem. But this out of my horizon at this moment, first must be some result on 3D source of ct3d and then think how to transfer it into TechDraw.

Repository: https://github.com/martinproks/cosmeticthread3d

Forum thread: https://forum.freecad.org/viewtopic.php?t=85047

Knurling is another similar geometry and probably similar approach. But first things first....

martinproks avatar Mar 06 '24 20:03 martinproks

If it helps, here is another macro that makes cosmetic threads: https://github.com/andesfreedesign/CosmeticThreads_FreeCAD

Author @andesfreedesign

MiqCG avatar Jun 23 '24 09:06 MiqCG

Hi, I know this and I tried it.

I had a little pause from FreeCAD (not only FreeCAD is life about ;-) ), but now I'm back to move it forward...

martinproks avatar Jun 30 '24 16:06 martinproks

@martinproks any news on this?

maxwxyz avatar Sep 04 '24 08:09 maxwxyz

@pierreporte IMO this makes sense with external threads implemented (should work the same as holes for displaying) https://github.com/FreeCAD/FreeCAD/issues/12679

maxwxyz avatar Oct 05 '24 09:10 maxwxyz

Yes, the feature is necessary for both internal and external threads.

pierreporte avatar Oct 05 '24 09:10 pierreporte

@pieterhijma Why did you remove the status in the board?

pierreporte avatar Oct 14 '24 21:10 pierreporte

@pierreporte, My apologies. I'm not aware that I changed anything. I did browse the board and studied the priorities and tried to filter. I remember that I clicked on this particular status to see what different options there were. I'll restore it to Todo (P1) which it was before.

pieterhijma avatar Oct 15 '24 07:10 pieterhijma

Here is a UI/UX proposal: https://design.penpot.app/#/view/a0a8e792-b2d2-818e-8005-594ea94fab2e?page-id=a0a8e792-b2d2-818e-8005-594ea94fab2f&section=interactions&index=0&share-id=7ad540b5-8190-815d-8005-595da691d1ca

It includes a new hole tool.

pierreporte avatar Nov 29 '24 17:11 pierreporte

@luzpaz No solution have been proposed, only a UI proposal.

I will write here more details about the desired solution.

pierreporte avatar Dec 03 '24 18:12 pierreporte

As discussed in Developers meeting on 1st December, here is a writing describing the desired feature.


Cosmetic threads

Current situation

In the Part Design workbench, the Hole feature is able to produce threads. These threads are modeled in 3D, that are resource-heavy (the generation of a single threads takes a short but noticeable amount of time). When the checkbox to model the threads is unchecked, the representation is simply the drilled hole, with no visual indication that it the hole is threaded. There is no feature to create external threads, or to add internal threads to existing holes (although the Hole feature can be used as a workaround). The Part workbench doesn’t provide threading features.

In the TechDraw workbench, threads created in the Part Design worbench are not recognized as such, whether they are modeled or not. Modeled threads are represented as they are visible in the 3D view. The workbench provides features to add standard threads symbols, both in top view and in side view, to dress up cylindrical features but it is not an automatic process and it doesn’t produce accurate results (for example, the diameter of a M3 thread annotation isn’t exactly 3 mm in diameter). The nature of these annotations is not taken into account by dimensioning tool.

Feature set

FreeCAD needs threading feature that can be applied in Part Design and Part workbenches without the need to model them while providing a visual cue of the existence of threads (hence the word “cosmetic”). Besides the integration of threads into the Hole feature, there should be standalone features to create external and internal threads on existing geometry. These new cosmetic threads must be understood by TechDraw that would generate automatically the correct annotations, compliant to drafting standards. Dimensions referencing threads annotation must be correct and display the right designation.

When material is removed from a cosmetic thread (for example an undercut near a shoulder), the removed section of the thread must be removed from the representation in TechDraw. It may seem obvious, but while most CAD application do understand correctly removal of material, Alibre doesn’t and is thus hardly usable in this regard. It is important that FreeCAD doesn’t fall in the same trap.

The Part Design and Part feature must allow the user to create both cosmetic threads and modeled threads. It should be possible to switch all threads of a part from cosmetic to modeled (and back) using a simple action (like an entry in the context menu of the body).

The Render workbench could make use of the feature by using a special texture for the threads to generate realistic appearance, or ask the user to switch to modeled threads for higher realism.

The features should be compatible with directional threads (e.g. buttress threads) or allow them to be easily implemented in a later stage.

The cosmetic threads should be understood by the CAM workbench to select the right tool automatically.

The features could be generic enough to allow an implementation of knurling using the same mechanism (see ISO 13444).

Standard threads

This section lists common thread standards and gives relevant input parameters. They can be sorted in the following categories:

  • General use threads: metric, unified inch
  • Aerospace threads: aerospace metric, aerospace unified inch
  • Piping threads: BSP parallel, BSP tapered, NPT, NPSC, NPTR, NPSM, NPSL
  • Trapezoidal threads: trapezoidal metric, ACME

Metric (M)

Thread shape per ISO 68-1.

Parameters:

  • Size (diameter): choice from list per ISO 261 (default) or numeric input
  • Pitch series (standard size only): coarse (default), fine, or custom
  • Pitch (non-coarse only): choice from list (default) or custom numeric input
  • Direction: right-hand (default) or left-hand
  • Tolerance class (optional): choice from list per ISO 965-1 (default), or custom numeric input

When pitch is selected from a list, the largest value is the default

Examples of designations: M3, M8×0.5 LH, M10-6g, M100×1

Unified inch (UN, UNR)

Thread shape per ASME/ANSI B1.1.

Parameters:

  • Size (diameter): choice from list per ASME/ANSI B1.1 (default) or numeric input
  • R-type: no (default) or yes
  • Pitch series (standard size only): coarse (UNC, UNRC) (default), fine (UNF, UNRF), extra fine (UNEF, UNREF), or custom
  • Threads per inch (custom only): numeric input
  • Direction: right-hand (default) or left-hand
  • Tolerance class (optional): choice from list per ASME/ANSI B1.1 (default), or custom numeric input

When threads per inch is selected from a list, the largest value is the default.

It is not necessary to name pitch series in the list (UNC, etc.) and they are indicated for reference only. “Coarse”, “Fine”, and “Extra fine” are enough.

Examples of designations: 7/8-9 UNC-2A, 7/8-9 UNRC LH, 1 1/2-32 UN

Aerospace metric (MJ)

Thread shape per ISO 5855-1.

Parameters:

  • Size (diameter): choice from list per ISO 5855-1 (default), or numeric input
  • Pitch: choice from list per ISO 5855-1 (default), or numeric input
  • Direction: right-hand (default) or left-hand
  • Tolerance class (optional): choice from list per ISO 965-1 (default), or custom numeric input

When pitch is selected from a list, the largest value is the default.

When the size/pitch combination is not in ISO 5855-1, the designation prefix is MJS instead of MJ.

Examples of designations: MJ20×20, MJS30×0.5-6h LH

Aerospace unified inch (UNJ)

Thread shape per ASME/ANSI B1.15.

Parameters:

  • Size (diameter): choice from list per ASME/ANSI B1.15 (default) or numeric input
  • Pitch series (standard size only): coarse (UNJC) (default), fine (UNJF), extra fine (UNJEF), or custom
  • Threads per inch (custom only): numeric input
  • Direction: right-hand (default) or left-hand
  • Tolerance class (optional): choice from list per ASME/ANSI B1.15 (default), or custom numeric input

When threads per inch is selected from a list, the largest value is the default.

It is not necessary to name pitch series in the list (UNC, etc.) and they are indicated for reference only. “Coarse”, “Fine”, and “Extra fine” are enough.

Examples of designations: 7/8-9 UNJC-2A, 7/8-9 UNJC LH, 1 1/2-32 UNJ

BSP parallel (G)

Thread shape per ISO 228-1.

Parameters:

  • Size: choice from list per ISO 228-1
  • Tolerance class (external only, optional): choice from list per ISO 228-1
  • Truncated: yes (default) or no

Examples of designations: G 1/4, G 1/2 A

BSP tapered (R, Rp, Rc)

Thread shape per ISO 7-1.

Parameters:

  • Size: choice from list per ISO 7-1
  • Shape (internal only): tapered (default), or cylindrical

Examples of designations: Rp 1 1/2, Rc 1 1/2, R 1 1/2

NPT

Thread shape per ASME B1.20.1.

Parameters:

  • Size: choice from list per ASME B1.20.1

  • Direction: right-hand (default) or left-hand

Example of designation: 1/8-27 NPT, 1/8-27 NPT LH

NPSC

Thread shape per ASME B1.20.1.

Parameters:

  • Size: choice from list per ASME B1.20.1
  • Direction: right-hand (default) or left-hand

Example of designation: 1/8-27 NPSC, 1/8-27 NPSC LH

NPTR

Thread shape per ASME B1.20.1.

Parameters:

  • Size: choice from list per ASME B1.20.1
  • Direction: right-hand (default) or left-hand

Example of designation: 1/2-14 NPTR, 1/2-14 NPTR LH

NPSM

Thread shape per ASME B1.20.1.

Parameters:

  • Size: choice from list per ASME B1.20.1
  • Direction: right-hand (default) or left-hand

Example of designation: 1/8-27 NPSM, 1/8-27 NPSM LH

NPSL

Thread shape per ASME B1.20.1.

Parameters:

  • Size: choice from list per ASME B1.20.1
  • Direction: right-hand (default) or left-hand

Example of designation: 1/8-27 NPSL, 1/8-27 NPSL LH

Metric trapezoidal (Tr)

Thread shape per ISO 2901 and ISO 2904.

Parameters:

  • Size (diameter): choice from list per ISO 2902 (default), or numeric input
  • Pitch: choice from list per ISO 2902 (default), or numeric input
  • Starts: numeric input (1 is default)
  • Direction: right-hand (default) or left-hand
  • Tolerance class (optional): choice from list per ISO 2903 (default), or numeric input

When pitch is selected from a list, the middle value is the default (per ISO 2902).

Example of designations: Tr 8×1.5 7e, Tr 60×18 (P9) LH

Imperial trapezoidal (ACME)

Thread shape per ASME/ANSI B1.5.

Parameters:

  • Size (diameter): choice from list per ASME/ANSI B1.5 (default), or numeric input
  • Threads per inch: choice from list per ASME/ANSI B1.5 (default), or numeric input
  • Starts: numeric input (1 is default)
  • Direction (right-hand (default) or left-haund
  • Tolerance class (optional): choice from list per ASME/ANSI B1.5 (default), or numeric input

When threads per inch is selected from a list, the largest value is the default.

Examples of designations: 1.750-4-ACME-2G, 1.750-4-ACME-2G-LH, 2.875-0.4P-0.8L-ACME-4G

UI / UX

The standalone thread feature has a different interface than the integrated thread capability of the Hole tol.

Standalone thread feature

Catia was the most important source of inspiration. Its documentation show how it works. The screenshot below comes from there.

Pasted image 20241214152207

The first step is to chose the location of the thread. The user first selects the lateral face of the thread (either a cylinder or a cone). The feature automatically detects if the surface is concave or convex to determine if the thread will be external or internal. Then, the starting point is selected. It can be a plane, a face, or a point, not necessarily on the part. Then, the end is selected via several modes: dimension (a fixed length, with a button to reverse the direction), up to geometry (same as the start: a face, a plane, or a point, not necessarily on the geometry), or through all.

The second step is to set the thread parameters. The user first selects the standard. Then, a size is automatically determined by computing the lateral face diameter, but the user can change it. Depending on the standard, there can be more parameters like pitch and tolerances. The full designation of the thread is displayed so that the user can easily check the design. The threading standard should be displayed so that users can be sure that their design is correct. The designation is not sufficent for this.

The last step lets the user chose to make either a cosmetic thread or a modeled thread.

The screenshot below is the Figma prototype for the standalone thread feature.

Pasted image 20241214153640

To better integrate the new threads to the existing Hole tool, its interface is getting fully redesigned. The work isn’t mature enough but a few key principles can be presented.

The firsrt selection is the sketch containing all the centers for the new hole pattern. Then the user selects the hole type (straight hole, countersink hole, etc.). At this point, the geometry of holes can be defined.

The thread is an option, that, when it is not activaed, is completely folded. Unlike, the current Hole tool, it is not fully visible unless activated to keep the task panel as clean as possible. When activated, the drill diameter is set automatically for the selected thread, unless the user wants to chose a custom value.

pierreporte avatar Dec 14 '24 14:12 pierreporte

In Solidworks, there is a dashed lines displayed around threads to show the thickness of threads. This could be useful to help users estimate how much material is left when they add or remove material near threads.

image

Also in Solidworks, recent versions introduced a normal map texture to increase realism of cosmetic threads.

image

pierreporte avatar Jan 07 '25 20:01 pierreporte

did a test of the mockup based on #19052

i've drawn the svgs myself, and there is a lot of cleanup and tweaking still, but it looks promising after only a morning

Videocaptura de pantalla_20250114_151138.webm

alfrix avatar Jan 14 '25 18:01 alfrix

@alfrix That’s awesome! Could you please post this as a comment in #19052 so we can discuss there? Issue #5567 is only for cosmetic threads.

pierreporte avatar Jan 14 '25 18:01 pierreporte

A 1000 € reward will be given to the contributor that writes a pull request, solving this issue, that gets merged. It will be paid by the FreeCAD Project Association. It is to be considered an incentive. Grant applications are welcome, but the total amount will exclude the reward.

pierreporte avatar Apr 29 '25 20:04 pierreporte

The specification written in https://github.com/FreeCAD/FreeCAD/issues/5567#issuecomment-2543142577, including dedicated threading features, automatic TechDraw support, new thread system, and UI/UX overhaul will be transformed into a dedicated FEP.

pierreporte avatar Aug 17 '25 14:08 pierreporte

The standalone thread feature has been moved to a separate issue: https://github.com/FreeCAD/FreeCAD/issues/23257

pierreporte avatar Aug 21 '25 21:08 pierreporte