Screw Maker

Need help, or want to share a macro? Post here!
mdhill
Posts: 39
Joined: Mon Apr 24, 2017 7:37 pm

Re: Screw Maker

Postby mdhill » Wed Jun 07, 2017 9:33 pm

Thanks Ulrich, success!

Mike
rachdatu
Posts: 15
Joined: Thu Jun 22, 2017 10:26 am
Location: Switzerland

Re: Screw Maker

Postby rachdatu » Thu Nov 09, 2017 2:51 pm

Thanks again Ulrich for this great macro.

I needed to 3D print a nut for my tripod (1/4" UNC).

I managed to make a few by changing a M6 ISO4032 nut with the following parameters:
In the python script, I modified line 1403:

Code: Select all

'M6':    (1.27,  0.2, 6.75, 9.5, 12.1, 4.7, 3.9, 10.5),
And added some tolerances in 4006 and 4306 like mr_cg suggested it: (0.6 instead of 0.4)

Code: Select all

d = float(d) + 0.6
All in one, the nut is OK. It needs a little force but it can be done with 2 fingers only :-)

For those interested, I have uploaded the design.

Let me know if you change it.
Thanks

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Attachments
nut_tripod.FCStd
(483.17 KiB) Downloaded 57 times
ulrich1a
Posts: 1842
Joined: Sun Jul 07, 2013 12:08 pm

Re: Screw Maker

Postby ulrich1a » Sat May 19, 2018 7:42 pm

I made an update to Screw Maker, in order to play together with Bodies and Parts. The screws do now observe the placement of a Body. If the Body is inside of a Part, the screw is added to the Part as well. I tried to improve the orientation of the screw-placement. So hopefully there are less cases with flipped screws inserted.

Ulrich
Attachments
screw_maker2_2.py.zip
(36.05 KiB) Downloaded 230 times
User avatar
ppemawm
Posts: 445
Joined: Fri May 17, 2013 3:54 pm
Location: Manhattan New York

Re: Screw Maker

Postby ppemawm » Sat May 19, 2018 8:48 pm

Thanks for the update ulrich1a. Works as advertized!
This has been my go-to macro of all time.
clytle374
Posts: 97
Joined: Wed Nov 06, 2013 3:58 am

Re: Screw Maker

Postby clytle374 » Sat May 26, 2018 4:27 pm

Thanks for the update. I think my git build is still got a few issues after the qt5 update. Anyway screwmaker isn't working.

Upon loading freecad I get the these lines, including them incase they are related
cory@cory-laptop ~/buildfreecaddev $ ./bin/FreeCAD
FreeCAD 0.18, Libs: 0.18R13799 (Git)
�� Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2018
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##

Fasteners workbench Loaded
During initialization the error UI file does not exist occurred in /home/cory/buildfreecaddev/Mod/Draft/InitGui.py
Please look into the log file for further information
During initialization the error UI file does not exist occurred in /home/cory/buildfreecaddev/Mod/Arch/InitGui.py
Please look into the log file for further information
When trying to execute the screwmaker macro I get this
Traceback (most recent call last):
File "/home/cory/.FreeCAD/screw_maker2_2.py", line 5448, in <module>
class ScrewMacro(object):
File "/home/cory/.FreeCAD/screw_maker2_2.py", line 5451, in ScrewMacro
d.ui.setupUi(d)
File "/home/cory/.FreeCAD/screw_maker2_2.py", line 1771, in setupUi
self.retranslateUi(ScrewMaker)
File "/home/cory/.FreeCAD/screw_maker2_2.py", line 1781, in retranslateUi
ScrewMaker.setWindowTitle(QtGui.QApplication.translate("ScrewMaker", "Screw-Maker 2.2", None, QtGui.QApplication.UnicodeUTF8))
<type 'exceptions.AttributeError'>: type object 'PySide2.QtWidgets.QApplication' has no attribute 'UnicodeUTF8'
thanks again
Cory

EDIT: I found this is a problem when migrating from qt4 to qt5 which I was forced into a few months back. https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5
== QCoreApplication::UnicodeUTF8 is deprecated ==

This enum type used to define the 8-bit encoding of character string arguments to translate(). This enum is now obsolete and UTF-8 will be used in all cases. So remove all instances of QCoreApplication::UnicodeUTF8. For example:
Href_Gui->setWindowTitle(QApplication::translate("Href_Gui", "Url / www", 0, QApplication::UnicodeUTF8));
label->setText(QApplication::translate("Href_Gui", "Text:", 0, QApplication::UnicodeUTF8));
label_2->setText(QApplication::translate("Href_Gui", "Url:", 0, QApplication::UnicodeUTF8));
label_3->setText(QApplication::translate("Href_Gui", "Target / Name:", 0, QApplication::UnicodeUTF8));
to
Href_Gui->setWindowTitle(QApplication::translate("Href_Gui", "Url / www", 0));
label->setText(QApplication::translate("Href_Gui", "Text:", 0));
label_2->setText(QApplication::translate("Href_Gui", "Url:", 0));
label_3->setText(QApplication::translate("Href_Gui", "Target / Name:", 0));
Just FYI
Cory
abdullah
Posts: 2476
Joined: Sun May 04, 2014 3:16 pm

Re: Screw Maker

Postby abdullah » Wed Jun 13, 2018 1:02 pm

ulrich1a wrote:
Sat May 19, 2018 7:42 pm
I made an update to Screw Maker, in order to play together with Bodies and Parts.
Thanks. I like this macro/module a lot.

One question: How can I make the screws solid internally?. They are hollow:
Shell_Screw2.png
Shell_Screw2.png (39.83 KiB) Viewed 367 times
EDIT: Maybe they are not hollow and it is a trick of the clip plane, when exporting the STL and opening it in Slic3r infill is generated...
chrisb
Posts: 10873
Joined: Tue Mar 17, 2015 9:14 am

Re: Screw Maker

Postby chrisb » Wed Jun 13, 2018 6:01 pm

CheckGeometry tells it's solid and cutting someth e.g. with a boolean cut shows it as well. It must be the meshing which makes it a shell.
abdullah
Posts: 2476
Joined: Sun May 04, 2014 3:16 pm

Re: Screw Maker

Postby abdullah » Thu Jun 14, 2018 12:17 pm

chrisb wrote:
Wed Jun 13, 2018 6:01 pm
CheckGeometry tells it's solid and cutting someth e.g. with a boolean cut shows it as well. It must be the meshing which makes it a shell.
Thanks for the two pointers. Why did not I think of it?

When using checkGeometry on a M6x30 screw I get this:
M6x30_checkgeo.png
M6x30_checkgeo.png (121.25 KiB) Viewed 312 times
screw_cut_trials.fcstd
(283.78 KiB) Downloaded 12 times
The geometry is not valid. I am using:

OS: Ubuntu 16.04.4 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13920 (Git)
Build type: None
Branch: master
Hash: 08910e71e423c02da46018c47e34002df4fde1f9
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0

The screw I obtained it from the fasteners WB. I just updated it (is there an obvious way of getting the WB version?).

In my special screws, which have a thread pitch of 3mm, I get also an invalid solid, but it says unconnected shell:
CT_Screw_invalid_geo.png
CT_Screw_invalid_geo.png (94.32 KiB) Viewed 312 times
If I try to cut it with the cube, FreeCAD crashes.

I am not sure what you will load without my WB installed, by the file is this:
screw_cut_trials.fcstd
(369.94 KiB) Downloaded 8 times
When I load these in slic3r, I am getting this:
CT_Screw_slic3r.png
CT_Screw_slic3r.png (37.52 KiB) Viewed 312 times
I will review the code I am using, as maybe I am doing something really wrong....
abdullah
Posts: 2476
Joined: Sun May 04, 2014 3:16 pm

Re: Screw Maker

Postby abdullah » Thu Jun 14, 2018 12:51 pm

I know how to cause/prevent the problem. If I use a pitch size of 3mm the problem is there as above. However if I use a pitch size of 2mm there is no problem. Perfect solid to checkGeometry. Perfect solid when cutting. Perfect Import to slic3r.

Any idea why the pitch size could be the problem?
CT_Screw_2mm.png
CT_Screw_2mm.png (27.63 KiB) Viewed 307 times
abdullah
Posts: 2476
Joined: Sun May 04, 2014 3:16 pm

Re: Screw Maker

Postby abdullah » Thu Jun 14, 2018 1:15 pm

I have shared my experimental WB in here:
https://github.com/abdullahtahiriyo/ConstructionToy

I do not think it will be generally useful. It is just a toy...

BTW, it requires ScrewMaker 2.2...