Fasteners workbench for FreeCAD

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:

To install the workbench simply download this file: Fasteners_V0.2.15
Extruct the file into FreeCAD Mod directory.
(On Windows its somewhere like “C:\Program Files\FreeCAD 0.15\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:

FSdir

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:
FSToolbar

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):

FSParams

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):
FSSelect

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:
FSCreated

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 (FSFlip) in the toolbar.

To attach an existing fastener to a different feature, select the screw, then control-select the new feature:
FSSelMove

Now press the Move button (FSMove) in the toolbar. The screw will move to the new location:
FSMoved

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 (SimplifyObj) 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.

 

31 Responses to 'Fasteners workbench for FreeCAD'

  1. Harry D. says:

    Impressive workbench – well done. Thanks! 🙂

  2. hpb says:

    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

  3. Franck says:

    Is that possible for have inch stew

  4. Thorsten says:

    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.

  5. cShellPro says:

    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.

  6. 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

    • shaise says:

      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!

  7. GoyoR says:

    Tanks !!!!!!!!!!!

  8. Colin says:

    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

    • shaise says:

      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

  9. molecular_models says:

    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.

    • molecular_models says:

      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.

      • shaise says:

        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

  10. fourchette says:

    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

  11. Alexander says:

    God bless you! This great workbench save me a huge amount of time!

  12. Paul Perrin says:

    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 🙁

    • shaise says:

      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

  13. sal says:

    Works really nice!

  14. Joan says:

    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

  15. Karsten says:

    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

    • shaise says:

      Try the github version. It should be QT5 compatible.
      https://github.com/shaise/FreeCAD_FastenersWB

      • Karsten says:

        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’

Leave a Reply

Your email address will not be published. Required fields are marked *

*