Screw Maker

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Screw Maker

Post by ulrich1a »

mr_cg wrote:@ ulrich1a: Really great screw maker makro .... WOW !!!!
Thanks!

The script was thought as a source of standard parts. It seems now, there is a demand for all kind of specials. I did not program for the script a long time now. When I programmed the real thread, I tried a lot of strategies, because several of them did not work for all dimensions. There is no warranty, that anything works, if the geometry is away from standard thread data. Thats said, all the screws and the screw-tap are made from tables.
So changing values in those tables should give you other dimensions.
P is the pitch. The screw-tap for inner threads uses the "tuningTable". In principle changing in this table in the line for M24 the value of 3.0 to 5.0 should give the wanted result. But I can not test now.

Ulrich
clytle374
Posts: 172
Joined: Wed Nov 06, 2013 3:58 am

Re: Screw Maker

Post by clytle374 »

I will look and see if I can come up with something. Being able to to attach things is nearly as important as the wheel, lol

Really nice macro btw.
clytle374
Posts: 172
Joined: Wed Nov 06, 2013 3:58 am

Re: Screw Maker

Post by clytle374 »

IMG_20170227_221013.jpg
IMG_20170227_221013.jpg (156.94 KiB) Viewed 3498 times
Printed a 36mm bolt and cut a nut with the bolt. Resized the nut to 105% for the clearance. Fits well, but didn't think it through and the slicer resized z axis also and it gets tight on the last 2 threads due to thread pitch mismatch. The thin nut was when I had to abort the print to leave the house, it fits good.

Guess I need to figure out how to scale the nut in freecad and only in x and y. Still not the ideal solution, but works for this project.
chrisb
Veteran
Posts: 54207
Joined: Tue Mar 17, 2015 9:14 am

Re: Screw Maker

Post by chrisb »

You can make a Draft->Clone and scale that.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
clytle374
Posts: 172
Joined: Wed Nov 06, 2013 3:58 am

Re: Screw Maker

Post by clytle374 »

chrisb wrote:You can make a Draft->Clone and scale that.
Thanks, I have a nut and a bolt now. Surely won't work well on small thread though.

Cory
mr_cg
Posts: 19
Joined: Fri Feb 10, 2017 8:26 pm

Re: Screw Maker

Post by mr_cg »

The 3D printed screws are fitting perfectly on real nuts. Amazing perfection.
Tested with several sizes (e.g. M5, M6, M8). No modification needed on external threads.

https://twitter.com/allabout3dblog/stat ... 2874830850

The 3D printed nuts (inner thread) are too tight.
For all inner threads i add +0,4mm to the diameter an then ALL 3D printed nuts are fitting perfectly the 3D printed screws.
This is the "play" my 3D printed inner/external parts need to fit/slide perfectly.

For the nuts (inner threads) i modified the script (line 4006 und 4306) to add +0,4mm to the diameter:

Code: Select all

d = float(d)+0.4
The script is really excellent !!! Thanks to Ulrich for sharing this masterpiece.

Two things i would like to wish for later versions:
1. Option to manually increase/reduce the helix diameter (e.g. Manual Helix Offset, PLAY [mm] => +1.00mm .... -1.00)
2. 1/4" and 3/8" UTC photo screws/nuts used for tripods and cameras. They are very similar to metric threads, only pitch and helix diameter differs.

https://www.fotoschraubenshop.de/info-1/

I know that it's a lot for work to do such a great script and you cannot fulfill every wish.
Anyhow i would be really happy to see some updates from this amazing script. :D
Ginko
Posts: 1
Joined: Tue Apr 25, 2017 9:34 am

Re: Screw Maker

Post by Ginko »

ulrich1a wrote:After a long pause with other things I got some time to work on the screw maker library. Here is version 2.0.
screw_maker2_0.py.zip
It should be a little bit faster. The making of the real thread is definitely faster. I could make work it on a wider range of thread diameters, see picture. The document with the shown screws has a size of 2.5 megabyte.
There may be still some issues with some types of screws or combinations of diameters and length and type of screws.
I could not test all combinations, if they produce a valid shape. Most of them should do it. Please report any issues.

I added a screw-tap in order to facilitate cutting of inner threads with real thread.
Nuts are added and two other screw-types.

I hope Shaise is able to integrate this new version in the fastener workbench. I applied the standard python way, so screw maker can be used both as macro and as a python library.
I will make a github version, but have first to learn how to make it.

Have fun
Ulrich
Hi Ulrich,

There is an issue about the screw length. I try to make an ISO4762-M5x70 but it doesn't do anything. The longest what it does is the 50mm one.
Any advice?

Thanks a lot!!

Ginko
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Screw Maker

Post by ulrich1a »

Ginko wrote:There is an issue about the screw length. I try to make an ISO4762-M5x70 but it doesn't do anything. The longest what it does is the 50mm one.
Any advice?
You should see a text at the top of the diaIog saying:

Code: Select all

ISO4762-M5 has lengths from 8 to 50 and not 70!
I used the values about diameter and length from the published standards. According to this, ISO4762-M5x70 will be kind of a custom screw. In order to get one, you have to edit line 1077 in the macro. Change the maximum length from 50 to 70.

Code: Select all

# range of typical srew lengths
#    min_length,  max_length
iso4762range = {
  'M1.6':('2.5', '16'),
  'M2':  ('3', '20'),
  'M2.5':('4', '25'),
  'M3':  ('5', '30'),
  '(M3.5)':('6', '35'),
  'M4':  ('6', '40'),
  'M5':  ('8', '70'),


Ulrich
mdhill
Posts: 85
Joined: Mon Apr 24, 2017 7:37 pm

Re: Screw Maker

Post by mdhill »

Ulrich, thanks for your work on the script. I get this error when I run it:

Traceback (most recent call last):
File "/home/mike/.FreeCAD/Macro/screw_maker2_0.py", line 1826, in guiCreateScrew
myObj = self.theScrew.createScrew(ST_text, ND_text, NL_text, threadType)
File "/home/mike/.FreeCAD/Macro/screw_maker2_0.py", line 2178, in createScrew
screw = self.makeIso4017_2(ST_text, ND_text,l)
File "/home/mike/.FreeCAD/Macro/screw_maker2_0.py", line 3033, in makeIso4017_2
headShell = Part.Shell(headFaces)
Part.OCCError: Shape is not a shell

I came across the Troubleshooting section in the build instructions, and added -DCXXFLAGS="-D_OCC64" to the cmake line, but it didn't help. Do you have any suggestions for what I could try?

Mike

OS: "Fedora release 27 (Rawhide)"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11237 (Git)
Build type: Release
Branch: master
Hash: 2b323670c73b2d2635e34eb1a95a31b90eda6479
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.9.1.oce-0.18
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Screw Maker

Post by ulrich1a »

Fr
mdhill wrote: Wed Jun 07, 2017 1:43 am Do you have any suggestions for what I could try?
Screw Maker needs an update. It looks like there is an incompatibility between opencascade version 6.8 and later versions. This effects faces made from circles. The face has an orientation, meaning a front and a back side. Which side is the front side is now different, depending what version of opencascade is used.

As a workaround you have to change the line in the function makeHextool line 3995 from

Code: Select all

    circ=Part.makeCircle(cir_hex/2.0,Base.Vector(0.0,0.0,-k_hex*0.1))
to

Code: Select all

    circ=Part.makeCircle(cir_hex/2.0,Base.Vector(0.0,0.0,-k_hex*0.1),Base.Vector(0.0,0.0,-1.0))
Ulrich
Post Reply