Update 21-Jul-2015: Updated to Ulrich’s V2.0 screw_maker. More fasteners and nuts!
Update 01-Oct-2015: Add Bill-Of-Material generation
Many times when I design parts in FreeCAD (Specially Sheet Metal) I need to add standard fasteners such as screws, press-nuts, stand-offs etc… I used to add them manually, usually just as a rough shape, just to have it in the drawing for clearance. Fortunately, volunteers from the FreeCAD community begun to release addons to generate such standard parts automatically. One of these addons is the very nice macro by Ulrich Brammer, that generates several types of screws with high accuracy and conformance with the standard.
To make it easier to use, and also conform with parametric nature of FreeCAD, I decided to write a simple workbench wrapper with WYSIWYG Icons and some controls.
Installation:
Starting from Frecad 0.17, The installation is simple and done using FreeCad’s Add-on manager (Under ‘Tools’ menu)
For off-line manual installations:
Download this file: FastenersWb
Extract the file into FreeCAD Mod directory.
(On Windows its somewhere like “C:\Program Files\FreeCAD 0.18\Mod”, On Linux: “~/.FreeCAD/Mod” , create it if not exist)
That’s it.
Under the Mod directory you should see a new directory called Fasteners:
How to use:
Usage is pretty straightforward:
Start a new document in FreeCAD. Select the Fasteners workbench from the drop-down list.
A series of screws will show on the toolbar:
Simple Usage:
Clicking on any of the screws will create this screw in the origin position with default size. To change size/length select the newly created screw, then go to the data tab in the property panel, there you can change diameter and length. (For now it is in metric standard):
Changing the “thread” property to “true” will render the screw threads as well. Please note that generating threads takes considerable amount of time, during which, FreeCAD will not be responsive.
The invert and offset properties are only applicable to attached fasteners. See next.
Attached fasteners:
Fasteners can also be attached to features in other parts. To attache a screw to a part, the part must have features with circular edges, such as holes. To attach screws to holes, select the desired circular edge or several edges (You can also select a face if you want to select all holes in that face):
Now click on the desired screw. A screw will be placed on each of the selected features, trying to match the screw size to the hole size:
You can now, like before, change diameter and length from the properties panel. If you wish the screw to hover above the hole, you can set the “offset” property to the desired distance. Sometimes the screw does not detect the direction correctly and appears upside down. To correct this change the “invert” property to true, or select the screw and press the Flip button () in the toolbar.
To attach an existing fastener to a different feature, select the screw, then control-select the new feature:
Now press the Move button () in the toolbar. The screw will move to the new location:
An attached screw will move with the part it is attached to. If you wish to detach the screw from the parent part, simply select only the screw, then press the move button. The screw is now detached and can be moved individually.
Simplifying objects
It is important to note that if you wish to share FCStd files that contains fasteners (or parts from other custom parametric workbenches) with other people, they must install these workbenches as well, or else they will get errors when trying to use them.
However, if you just want to share the resulting parts, with no need to change object’s parameters, you can use the Simplify () function, to convert the fasteners to simple shapes. They will appear as new Shape parts in the model tree. You can then delete the original fasteners and save as a simple FCStd that can be read and used on any FreeCAD installation.
Source Code:
For those who are interested, GitHub code can be found here.
Future planned features:
The current workbench is just a wrapper to the screw_maker macro. As so it shows only screws (and a washer). I hope to soon add some press-nuts(added), studs(added) and stand-offs(added).
Once again, many thanks to Ulrich Brammer for his great screw maker macro.
That’s all folks!
Hope it helps.
Impressive workbench – well done. Thanks! 🙂
Your FB workbench works great. I really like it. In my actual project I use a lot of screws, washers and nuts. The BOM feature is also very helpful.
Would it be possible to count all the rest of the parts in project? I’m using the Assembly2 WB for building up my project.
Thanks a lot for your well done WB
Regards hpb
Is that possible for have inch stew
My workbench is based on existing screw library by Ulrich. This library supports only metric screws.
Is it possible to create new definitions screws
If you have programming knowledge you can try and modify the Python code. You can also try and leave a question in the forum: http://forum.freecadweb.org/
Fastastic work! Saves me a lot of time.
Is it possible to include a turning parameter? I need to turn some of the screws for perfect fit with the threads inside the holes.
Thank you very much.
The fastener workbench looks promising, however I can’t get it to work. After having installed it in my Mod folder, all I get is:
“invalid literal for int() with base 10: ‘Unknown’
I’m not sure what I can do to make it work.
what version of freecad do you use and what operating system?
Thank you for your reply. I’m on FreeCAD 0.16, running
OpenSuse 13.2 64bit. Every other workbench works perfectly, except the Fasteners.
OK, this looks familiar. Are you using Norm’s Freecad-community repository? if so, please look at the forum issue:
http://forum.freecadweb.org/viewtopic.php?f=8&t=11429&p=107332&hilit=fasteners#p107292
This can help.
Thank you for your reply. Had a look at the link provided, but it doesn’t solve it. All files exist, but it doesn’t work.
Hi, Iam using FreeCAD 0.16,running on OpenSuse 13.2. 64bit. Everything else works, except the Fastener WB.
Hi,
the problem is that the function in FastenerBase.py contains a test of the FreeCAD version and subversion. On my Debian 8.4 Linux box, the FreeCAD I have returns as version:
[‘0′, ’16’, ‘Unknown’, ‘Unknown’, ‘Unknown’]
and obviously the code snippet where tthe subversion is tested fails.
Just changing the code snippet to this:
#DropButtonSupported = int(FreeCAD.Version()[1]) > 15 and int(FreeCAD.Version()[2].split()[0]) >= 5165
#RadioButtonSupported = int(FreeCAD.Version()[1]) > 15 and int(FreeCAD.Version()[2].split()[0]) >= 5560
DropButtonSupported = int(FreeCAD.Version()[1]) > 15
RadioButtonSupported = int(FreeCAD.Version()[1]) > 15
removes the error. Probably there is a more refined way to achieve the same result, but at least this pinpoints the issue for me.
Cheers
Lorenzo
Lorenzo,
Yes, I found that myself and solved it (I decided that ince ver 0.16 is already stable, I just disregard the build number).
The latest version has this fix.
Thanks!
Tanks !!!!!!!!!!!
Love this works great, But is there a way to show the fastener in the drawing workbench I have tried but no success
any hints would be great thanks
Hi Colin,
The drawing workbench works on a single part, not an assembly. A crude workaround is to fuse the part with the fastener, then bring the fused part to the drawing. I think you better post this question in the freecad forum, as I guess many encountered your case:
http://forum.freecadweb.org
Hi, my first foray into 3D printing and design, and I must say Freecad rocks 😉
The screwmaker makes total sense – but am I missing something? Do these screw threads work? Or am I supposed to make the threads then “cut” the screw from the surrounding block?
Or perhaps for an M8 screw, have a hole that is 8.1?
Simply looking for a worked example where the threads work. Although they may wear down, there are scenarios that an all-in-one construction would be critical.
To expand further – I put some 4mm holes in a design I printed (for wood screws!), and investigated some metric bolts instead. A big of googling and I found this -> http://www.shender4.com/metric_thread_chart.htm
which gives different drill holes depending on the threads. So when I used the Screwmaker and it “matched” the 4mm hole, why did it pick M4? Not M5? I understand this is subtle as it is depends on the threads, but I am not familiar with the conventions used, or is this is the correct approach.
Hi,
There are 2 ways to match a screw:
1. pass through – when you want to put a bolt in a hole and close it with a nut on the other side (no threading in the matter) In this case a 4mm hole will pick an m4 screw
2. Thread in – when you want the screw to screw into the mater. In this case a 4mm hole will pick an M5 screw.
A small button in the toolbar will let you select which mode you want to work on.
shai
thank you ! thank you ! thank you !!!!
thank you so much for the fastener wb ! i just love it
However, i often use arrays to properly align holes and screw. I have noticed that while repeating screws and nuts with arrays, they are not counted in the generated BOM. Can it get fixed ? Assuming I want to implement it, where should i look first then ?
anyway, keep up the good work
fourchette
Hi fourchette,
The best way for these questions is to post them on FreeCad forum. (http://forum.freecadweb.org/)
There you can attach FCStd models as example for others to debug, and also consult regarding programming.
shai
God bless you! This great workbench save me a huge amount of time!
Fantastic – love this thing… I am doing loads of stuff on my new 3d printer… all those adaptors etc that are such a pain to find…
The bits that I have found missing that would be really useful is M26 which is a standard for microphone stand threads (I created a 3/4″ circle and threaded it which I think will work…), and 1/4″ UNC which is the standard camera/tripod thread… which I can’t seem to fake up cos its not a metric thread 🙁
Hi Paul,
This workbench is only a GUI wrapper over the screwMaker macro made by Ulrich. Unfortunately this macro supports only metric screws. You can try and ask Ulrich for extra screws at the freeCad forum
Works really nice!
OMG!! Great!!! I’m proud to use this amazing free soft … a lot of wise people sharing his talent to everyone!
thank you so much
Hi shaise
Really great work. Thanks for the workbench.
I have a problem when using the QT5 version of freecad running on a mac. When I try to generate countersinks the console shows me multible error messages.
Have you ever tried with QT5? Can you please have a look if you can update your workbench supporting QT5?
Kind regards
Karsten
Try the github version. It should be QT5 compatible.
https://github.com/shaise/FreeCAD_FastenersWB
Thanks for the reply. I already tried the current git version. But no success.
On Mac with the latest 0.17 build I get the following error. I asked the internet and it says that this is somehow related to the incompatibility from qt4 and qt5.
Running the Python command ‘FSFillet’ failed:
Traceback (most recent call last):
File “/Users/Karsten/Library/Preferences/FreeCAD/Mod/FreeCAD_FastenersWB-master/CountersunkHoles.py”, line 673, in Activated
Gui.Control.showDialog(FSTaskFilletDialog(None))
File “/Users/Karsten/Library/Preferences/FreeCAD/Mod/FreeCAD_FastenersWB-master/CountersunkHoles.py”, line 445, in __init__
FSFilletDialog.ui.fillTable(FSFilletDialog, self.baseObj, edgelist)
File “/Users/Karsten/Library/Preferences/FreeCAD/Mod/FreeCAD_FastenersWB-master/CountersunkHoles.py”, line 163, in fillTable
header.setResizeMode(0, QtGui.QHeaderView.Stretch)
‘PySide2.QtWidgets.QHeaderView’ object has no attribute ‘setResizeMode’
Shaise and Ulrich you are genious, thanks a lot for this nice work.
On my Freecad 0.16 Linuxmint 18.1 64bits I found a problem on the Fastener workbench.
The button allowing change between pass through/Thread in change just with the first click, then don’t change anymore.
Something to do ?
What version do you have? In my version its two separate buttons, not one.
I use Freecad 0.16 rev 6712(Git) 64 bits.For Fastener I have V0.2.13 01 Oct 2015 in the release notes of README.md
I have 2 buttons (tap-hole and pass-hole), but sometimes I get just one (pass-hole). I have to re-load Freecad !!!! First problem.
Then I did a part with 2 holes 4mm diameter and 2 holes 6mm.
I select tap-hole, then 1 hole 4mm and 1 6mm, then a screw. I got a M5 and a M8 ?
Now I select pass-hole, the 2 others holes, and I got the same (M5 instead M4, and M8 instead M6) Second problem.
Hi,
Thanks for the great library.
Just while using the press nut fasteners, if i make my hole the recommended diameter for the press nut and i place the press nut, the hole is way too big.
The press nut diameter seems to be too small.
Hi,
Best thing is to post your problem in FreeCAD forum, there you can attach the file so I can see the problem.
shai
very great! Thank you so much!! :-))
Thank you very much !!!!
Thanks, nice work.
I 3d printed a M12 nut and bolt, did not fit. I printed the bolt again at 98% size in x and y and it fits perfect. Also tried a M6 bolt and a M6 nut, but it seems the nut is printed as M5, it fits a metal M5 perfectly. So maybe a bug in the sizes or maybe an issue with the tolerances of 3d printing. I tried another nut to print as M6 but it came out as M5. The fact that the printed M6 nut fits a metal M5 bolt perfectly makes me suspect the M6 nuts are printed as M5, the question now how to print M6 nuts correctly, i am not a mechanical designed, just a hobby guy, i am getting nuts now 🙂
Hey Otto. you are right about needing to scale bolts 98% for 3d printing. Regarding the M6 = M5, what type of nut did you use?
Yes, the (outer thread) screw has to be made thinner by 2%. That is the key.
Thank you
Wonderful workbench! I too am using it for 3D-printed parts, to print parts that screw together. It would be an incredibly useful feature to be able to specify some sort of thread scaling factor to push them outward from the axis of rotation, so that using a threaded rod object as a tool to cut threads in another object will leave sufficient tolerance (as-is, it results in an interference fit). I might try to add the feature myself…we’ll see how it goes; I am not a Python expert by any means!
Yes, I Agree. I plan to add a general parameter to make the screws 3D printer friendly
Great workbench!
Is there a way of using it in a macro script?
There is a macro called ScrewMaker. this workbench is using it. You can use this macro as well. You can get it same way using the addon manager.
Thanks for this useful workbench. I need to be able to specify bolt lengths exactly- Well every mm would do if 0.1mm is too difficult to implement. The problem is, if you have,say, 19mm of material and you use 20mm for the bolt length then any nut is sunken in the material. The drop down box would be better (IMO) being a standard number field.
The workbench is based on existing macro that generate bolts. Unfortunately this macro have only standard sizes.
It would be great if the size range could be extended – I work with small parts, where we use down to M1. Also the addition of set screws with e.g. hex drive would be great as well.
This workbench is great! Thank you for your work.
Thanks for this very useful library – most constructors will need it.
What if I would add some threads to a part, can I use a ScrewTap? How can I make the add the screwtap to the part? Sorry if this is a very naive question.
Best regards
Torben Larsen
The best way to ask questions is via the FreeCad forum: http://forum.freecadweb.org.
any way, most screws can have thread by setting the ‘thread’ property to true.
if you want to tap a hole in the model, there is a special ‘threaded rod’ fastener
that can create inner threads by using boolean subtraction.
Hi,
Trying to install your workbench under FreeCAD 0.18.4.
Get an issue with the csv.reader() instruction line 116 of screw_maker.py.
There are no ‘unix’ dialect in my csv library (for Python 2.7.17) which seems to be the used at runtime.
Note that I also have Python 3.6.9 which has the ‘unix’ dialect in its csv library.
I do not know how to fix this issue, if you know what to do that will be much appreciated.
Running Ubuntu/Linux.
Thanks!
It is better to report it on the freecad forum: forum.freecadweb.org
Please in my Linux Mint 2020 don’t work. I copy the folder “Fastners” in the directory .FreCad\Mod\ but nothing appear in the menù under FreeCAD 0.18.4.
try using freecad 0.19, and also use the plugin manager to install it, not manualy
Installing the freecad fasteners workbench doesnt make it show up in freecads addon manager, quick please. I have a course on this and I dont wanna fail because of fastener not working :/
Remove old freecad with all subdirectories.
Install latest FreeCad 0.19 (from here: https://github.com/FreeCAD/FreeCAD/releases/tag/0.19_pre)
(addon not working in old versions)
From the menu select Tools -> Addon Manager
From the list on the left select fasteners
on the bottom press “Install/update selected”
after installation complete, close freecad and reopen it.
It should be in the list of workbenches now.
I have installed the latest version 0.18, but for company security the PC is not able to access internet. So I download the ZIP file Fasteners_V0.2.15 and unzipped the “Fasteners” directory to the \MOD directory, along with the others already there. Restarted FreeCad, but Fasteners option doesn’t appear at the pull-down menu. How to solve it? Thanks.
Try using ver 0.19, see if it helps.
Shaise, I copied the whole \Fasteners to the \MOD of version 0.19, close/open and it did not appear on the pull down menu of WBs… I think both, 0.18 and 0.19 require something else to include into the pull down, not only by the fact that a new folder is copied into the \MOD.
This is very strange, No there is no need to do anything else then to place the /fastener folder inside the /mod one. If this is a windows PC, you can also try to put it under the C:\Users\(your user name)\AppData\Roaming\FreeCAD\Mod
If this does not help, please try the freecad forum (forum.freecadweb.org). They might better guide you troubleshooting this issue.
Yes Shaise, I also copied the \fasteners into the C:\users\userid\AppData\Roaming\FreeCad\… where the macros shows link on Edit Preferences…
There is an error message though, at Report View upon starting FreeCad 0.18 or 0.19:
During initialization the error invalid character is identifier (, line1) occurred in C:\users\userid\Appdata\Roaming\FreeCad\Mod\Fasteners\InitGui.py
The first line of InitGui.py:
# -*- coding: utf-8 -*-
Dear Shaise, I renamed \PARTS to \PARTSxxxx and renamed \Fasteners to \Parts, now the invalid character identifier message is on \Parts… so, something is wrong with this line1… (“, line1) – I don’t know why the text “string” inside of “less than” and “bigger than” was cutout on my previous post…
Dear Shaise, by some suggestions from the forum, used Notepad++ in order to save the text of InitGuy.py with utf8 encoding, and not it works… wow.
Now when I select the WB from the pulldown menu, error:
Invalid Syntax (screw_maker.py, line 4362)…
The line shows: ‘if da None:’
(if da different than None:)
Dear Shaise, by suggestion from the forum, I used Notepad++ and saved the InitGui.py as UTF-8, it worked. wow.
Now a new error when I try to select the Fasteners from the pull down menu:
Invalid Syntax (screw_maker.py, line 4362)
Thank you for your kind support.
I finally found your
https://github.com/shaise/FreeCAD_FastenersWB
Download the whole set of files, and it works fast.
No Problems anymore.
May be there is some problems in your files from
http://theseger.com/projects/wp-content/uploads/2015/06/Fasteners_V0.2.15.zip
Thanks a bunch
Oh! really sorry about that… Since the move to internal add-on manager I stopped updating the zip file. Perhaps I need to point to the github repository instead.
This is a great workbench, thanks for all your effort. Ive come across an issue i cant resolve. I want to make effectively a negative of a bolt with a slight offset. So for example i want to make a hex hole that perfectly holds an m5 bolt head. if i simply subtract an m5 bolt from a shape i’m left with an exact m5 hole BUT this will be too tight to fit an m5 bolt especially when 3d print tolerances come in. What i need is something like an m5.2 hole! Any ideas how I can do this? could a future release allow such an ‘offset’? Thanks Joe
There is an option to make the thread wider or narrower to compensate for 3d printer tolerances, but not for the head. But the head is a simple hexagon, so making a hexagon cavity is quite easy to do separately without subtracting a bolt.
Hello,
Thank you for a really great workbench we can use for free!
I have a question. Is it possible that I make the whole piece threaded after specifying the length to be 60 mm or above? It always has half bottom thread instead of the whole piece and there’s this line to separate the two parts. Is there anyway I can get rid of that line and make it threaded the whole piece?
https://im.ge/i/image.11aAFCT
This is what I get when making thread true.
This is what I want to achieve:
http://cf.shopee.co.th/file/305eccfbd0c835c8ae1e3db41b158012
Thanks
Zong
The partly-sized thread is the standard. If you want to make non standard length thread, you can generate the screw without thread at all, then you can generate a die with the length of thread that you want and cut it from the screw.