From: Kemal <alc...@gm...> - 2013-07-31 14:45:31
|
Hey Guys, I've no experience with any CAD program but I've to Programming something cause my new project. My Project which is given me from my university as my Bachelor thesis and it demands from me to programming a python script which has to creates a Draft BSpline with given Vectors and converts it to a 3D model and finally export it as a Step file. This is the code, I could create a cube and export it but when I try to import Draft, I get an Error "File "/usr/lib/freecad/Mod/Draft/Draft.py", line 76, in <module> import FreeCAD, FreeCADGui, Part, math, sys, os, Image, Drawing, WorkingPlane ImportError: No module named FreeCADGui" freePath ='/usr/lib/freecad/lib' import sys sys.path.append(freePath) from FreeCAD import * import Part from PyQt4 import QtGui import Part # THE MAIN FUNCTION def main() : App.setActiveDocument("myDocu") App.ActiveDocument=App.getDocument("myDocu") App.ActiveDocument.addObject("Part::Box","Box") mycube = Part.makeBox(20,2,20) mycube = Part.cast_to_shape(mycube) App.ActiveDocument.recompute() __objs__ = [] __objs__.append( App.ActiveDocument.getObject("Box")) Part.export(__objs__,"Box.step") if __name__ == '__main__': main() I hope one of you can help me a little. Kemal <http://www.dict.cc/englisch-deutsch/thesis.html> |