From: Werner M. <wer...@gm...> - 2010-08-05 11:34:07
|
Here the second script: from PyQt4 import QtGui import sys, FreeCAD, FreeCADGui, Part def getMainWindow(): toplevel = QtGui.qApp.topLevelWidgets() for i in toplevel: if i.metaObject().className() == "Gui::MainWindow": return i raise Exception("No main window found") mw=getMainWindow() mw.showMinimized() doc=FreeCAD.newDocument() box=Part.makeCone(10,8,10) Part.show(box) # switch off animation so that the camera is moved to the final position immediately FreeCADGui.activeDocument().activeView().setAnimationEnabled(False) FreeCADGui.activeDocument().activeView().viewAxometric() FreeCADGui.activeDocument().activeView().fitAll() FreeCADGui.activeDocument().activeView().saveImage('/tmp/crystal.png',800,600,'Current') FreeCAD.closeDocument(doc.Name) # causes a crash because after processing this script the event is restarted!!! mw.deleteLater() |