error while execute macro

Need help, or want to share a macro? Post here!
BLdevloper
Posts: 9
Joined: Sun Mar 16, 2014 3:12 pm

error while execute macro

Postby BLdevloper » Sun Mar 16, 2014 3:17 pm

hello,

I´m getting the error: no module named PyQt4, while executing the macro screw maker makro(http://www.freecadweb.org/wiki/index.ph ... w_maker1_2).

I already installed PyQt on my mac so what is the problem? :?:
wmayer
Site Admin
Posts: 16649
Joined: Thu Feb 19, 2009 10:32 am

Re: error while execute macro

Postby wmayer » Sun Mar 16, 2014 3:28 pm

The problem could be that Python doesn't find the PyQt installation -- so check your sys.path:
import sys
sys.path # in this path list the directory of where PyQt is installed must be listed
If not you can extend it with sys.path.append("the_PyQt_path")

Another problem could be that the version of Python PyQt was built with doesn't match with the FreeCAD Python version. Note, for FreeCAD we need Python 2.x.
ulrich1a
Posts: 1958
Joined: Sun Jul 07, 2013 12:08 pm

Re: error while execute macro

Postby ulrich1a » Sun Mar 16, 2014 4:05 pm

BLdevloper wrote:I´m getting the error: no module named PyQt4
It could be that your FreeCAD-version is compiled without PyQt4-support and has only PySide instead.

I made a new Version of the Macro that should work with both versions.

Ulrich
screw_maker1_6.py.zip
Screw_maker with Pyside support
(18.55 KiB) Downloaded 913 times
wmayer
Site Admin
Posts: 16649
Joined: Thu Feb 19, 2009 10:32 am

Re: error while execute macro

Postby wmayer » Sun Mar 16, 2014 4:47 pm

Sure, but PyQt can still be used if found.
User avatar
ValkaTR
Posts: 6
Joined: Fri May 09, 2014 5:34 pm
Location: Tallinn, Estonia
Contact:

Re: error while execute macro

Postby ValkaTR » Fri May 09, 2014 5:53 pm

I didn't found special topic for screw_maker macro :<

About half of the screw types do not work.

"ISO4017", M5, 20, simple, works, outputs:

Code: Select all

PySyde is used
NominalLength: 20
NominalDiameter: M5
SimpleThread: True
SymbolThread: False
RealThread: False
screw Type ISO4017 selected 5.0 20.0
der Kopf mit l: 20.0
der Kopf mit iso: 0.2
der Kopf mit math a: 1.6
der Kopf geschnitten: 5.0
Placement: Placement [Pos=(0,0,0), Yaw-Pitch-Roll=(0,0,0)]
In Move Screw: <Part::PartFeature>
Selektionen: 1
"ISO7045", M5, 20, simple, doesn't work (quietly nothing created), outputs less messages:

Code: Select all

PySyde is used
Data checking20
Set Check_result into text TrueISO7045-M5x20 is in library available! 
NominalLength: 20
NominalDiameter: M5
SimpleThread: True
SymbolThread: False
RealThread: False
screw Type ISO7045 selected 5.0 20.0
Why no error message?

Real thread doesn't work. Nothing is created. It seems like it stops at

Code: Select all

screw_maker1_6.py:2620:      pipe = Part.Wire(helix).makePipeShell([cutProfile],makeSolid,isFrenet)
FreeCAD installed from AUR (Arch Linux)
Version: 0.14
Rev: 3544 (Git)
Release: 2014/05/05 22:24:16
ulrich1a
Posts: 1958
Joined: Sun Jul 07, 2013 12:08 pm

Re: error while execute macro

Postby ulrich1a » Sat May 10, 2014 3:27 pm

ValkaTR wrote:I didn't found special topic for screw_maker macro :<
I started a new topic, in order to get better feedback. I recently discovered some problems but did not upload my changes until today. So the latest changes can now be found here: viewtopic.php?f=22&t=6558#p52887

It seems the pyside migration of FreeCAD changed some more things. In older versions of FreeCAD it was possible to use 0 or 1 instead of False and True. This fails now at actual Linux versions.

There were also some problems at some screw types with the starting of the thread. I could not test all combinations with a real thread, as it takes a long time with each screw. So be patient when generating a screw with a real thread. It may take minutes!
Real threads above M14 may not work. This has to be improved too.

I still have to learn how to handle not expected errors. Debugging of macros with a user interface is no fun as python errors will be catched somewhere without any message.

Thanks for your feedback.
Additional error reports are welcome.

Ulrich