Fasteners workbench based on screw-maker

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
steve123
Posts: 149
Joined: Fri Sep 04, 2015 8:58 pm

Re: Fasteners workbench based on screw-maker

Post by steve123 »

@alex_55 I played around with the macro a bit. I noticed that when you overlay the internal threads with the external threads, the mesh of the peaks and valleys look good. However, the walls of the threads mesh perfectly with no tolerance. Does Ulrich's macro have a way to specify the class of the thread?
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Fasteners workbench based on screw-maker

Post by Kunda1 »

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
User avatar
alex_55
Posts: 62
Joined: Mon May 11, 2020 1:50 am

Re: Fasteners workbench based on screw-maker

Post by alex_55 »

steve123 wrote: Thu Feb 11, 2021 6:59 pm @alex_55 I played around with the macro a bit. I noticed that when you overlay the internal threads with the external threads, the mesh of the peaks and valleys look good. However, the walls of the threads mesh perfectly with no tolerance. Does Ulrich's macro have a way to specify the class of the thread?
This is one of the key limitations of the macro. I works based on the nominal simplified spec that all common 60 degree screw threads (inch AND metric) use. This simplification makes the profile generation very easy.

Image

https://en.wikipedia.org/wiki/Unified_Thread_Standard

"get toleranced threads into FastenersWB" is on my todo list for sure. Some implementation gremlins:
  • Shia has already added a compensation setting that scales the threads, but this is meant for 3D printing purposes, and not made with machine tolerances in mind. How do we get two thread fitting systems working in harmony?
  • UN and ISO threads use different designations for thread fit classes, even though mathematically they work the same AFAIK. Will have to set available fit classes for each screwtype
For now, you can probably approximate a properly toleranced thread using 3D print compensation.
Find the settings in Edit > Preferences > Fasteners (the WB must be loaded) > Thread generation

A version of my macro that replicates the 3d printing compensation exactly:

Code: Select all

import ScrewMaker, Part, FreeCAD
# variables (units are mm):
Dia = 10
Pitch = 1.0
Length = 10
InnerThread = False
# thread compensation variables
comp_A_outer = 0.99
comp_B_outer = -0.05
comp_A_inner = 1.030
comp_B_inner = 0.1
# make the thread:
rots = round(Length/Pitch)
hrots = rots*2
generator = ScrewMaker.FSScrewMaker()
if InnerThread:
  # tap object to cut internal thread
	obj = generator.makeInnerThread_2(Dia*comp_A_inner+comp_B_inner,Pitch,rots,None,Dia)
else:
  # external thread
  # the function returns a shell object, but we can cap it 
  # and make it solid with a single circular face
  cap = Part.makeFace(Part.makeCircle((Dia*comp_A_outer+comp_B_outer)/2,FreeCAD.Vector(0,0,2*Pitch)),"Part::FaceMakerSimple")
  shellthread = generator.makeShellthread(Dia*comp_A_outer+comp_B_outer,Pitch,hrots,True,0)
  obj = Part.makeSolid(Part.Shell(cap.Faces+shellthread.Faces))

Part.show(obj)

steve123
Posts: 149
Joined: Fri Sep 04, 2015 8:58 pm

Re: Fasteners workbench based on screw-maker

Post by steve123 »

alex_55 wrote: Mon Feb 15, 2021 11:45 pm A version of my macro that replicates the 3d printing compensation exactly:

Code: Select all

import ScrewMaker, Part, FreeCAD
# variables (units are mm):
Dia = 10
Pitch = 1.0
Length = 10
InnerThread = False
# thread compensation variables
comp_A_outer = 0.99
comp_B_outer = -0.05
comp_A_inner = 1.030
comp_B_inner = 0.1
# make the thread:
rots = round(Length/Pitch)
hrots = rots*2
generator = ScrewMaker.FSScrewMaker()
if InnerThread:
  # tap object to cut internal thread
	obj = generator.makeInnerThread_2(Dia*comp_A_inner+comp_B_inner,Pitch,rots,None,Dia)
else:
  # external thread
  # the function returns a shell object, but we can cap it 
  # and make it solid with a single circular face
  cap = Part.makeFace(Part.makeCircle((Dia*comp_A_outer+comp_B_outer)/2,FreeCAD.Vector(0,0,2*Pitch)),"Part::FaceMakerSimple")
  shellthread = generator.makeShellthread(Dia*comp_A_outer+comp_B_outer,Pitch,hrots,True,0)
  obj = Part.makeSolid(Part.Shell(cap.Faces+shellthread.Faces))

Part.show(obj)

Thank you very much for the update to the macro.
Qutub Abro
Posts: 2
Joined: Thu Feb 18, 2021 4:08 am

Fastener WB, clicking on "Counter Sunk" hangs FreeCAD

Post by Qutub Abro »

I have FreeCAD V0.19 installed. I used "Fastener WB" to make a counter sunk hole in my FreeCAD design. But when I click on the Diameter to change it to M4, The FreeCAD hangs.

Fastener WB was working fine on FreeCAD V0.18.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Fastener WB, clicking on "Counter Sunk" hangs FreeCAD

Post by jmaustpc »

Please post your version data in the manner explained in the forum rules link above this forum.

The most likely reason for a 3rd party add on to fail in a newer FreeCAD is that the 3rd party may have not updated their code to keep it compliant with the newer version of Python used in the newer FreeCAD.

Over recent time, there has been a need to transition to Python 3 since Python two has long since passed end of life.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Fastener WB, clicking on "Counter Sunk" hangs FreeCAD

Post by Kunda1 »

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
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Fasteners workbench based on screw-maker

Post by Kunda1 »

Added
Fasteners_Flip
Fasteners_Move
Anyone want to check?
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
User avatar
shaise
Posts: 470
Joined: Thu Jun 11, 2015 8:11 am

Re: Fasteners workbench based on screw-maker

Post by shaise »

Kunda1 wrote: Wed Mar 31, 2021 2:46 am Added
Fasteners_Flip
Fasteners_Move
Anyone want to check?
Looks correct to me. Thanks!
hpbmo
Posts: 44
Joined: Wed Apr 26, 2017 6:28 pm
Location: Switzerland

Re: Fastener WB, clicking on "Counter Sunk" hangs FreeCAD

Post by hpbmo »

Here it works with FASTENERSWB_VERSION = 'V0.3.32'



OS: Windows 10 Version 2004
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: German/Switzerland (de_CH)

Regards
Hanspeter
Attachments
Countersunk.FCStd
(12.81 KiB) Downloaded 48 times
Countersunk.jpg
Countersunk.jpg (51.55 KiB) Viewed 2612 times
Post Reply