00001 /*************************************************************************** 00002 * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #include "PreCompiled.h" 00025 #ifndef _PreComp_ 00026 # include <Python.h> 00027 #endif 00028 00029 #include <Base/Console.h> 00030 #include <Base/Interpreter.h> 00031 00032 #include "CompleteConfiguration.h" 00033 00034 extern struct PyMethodDef Complete_methods[]; 00035 00036 PyDoc_STRVAR(module_Complete_doc, 00037 "This module is the Complete module."); 00038 00039 00040 /* Python entry */ 00041 extern "C" { 00042 void AppCompleteExport initComplete() 00043 { 00044 // load dependent module 00045 try { 00046 Base::Interpreter().loadModule("Part"); 00047 Base::Interpreter().loadModule("Mesh"); 00048 Base::Interpreter().loadModule("Points"); 00049 //Base::Interpreter().loadModule("MeshPart"); 00050 //Base::Interpreter().loadModule("Assembly"); 00051 Base::Interpreter().loadModule("Drawing"); 00052 Base::Interpreter().loadModule("Raytracing"); 00053 # ifdef COMPLETE_SHOW_SKETCHER 00054 Base::Interpreter().loadModule("Sketcher"); 00055 # endif 00056 Base::Interpreter().loadModule("PartDesign"); 00057 Base::Interpreter().loadModule("Image"); 00058 //Base::Interpreter().loadModule("Cam"); 00059 # ifdef COMPLETE_USE_DRAFTING 00060 try { 00061 Base::Interpreter().loadModule("Draft"); 00062 } 00063 catch (const Base::PyException& e) { 00064 // If called from console then issue a message but don't stop with an error 00065 PySys_WriteStdout("Import error: %s\n", e.what()); 00066 } 00067 # endif 00068 } 00069 catch(const Base::Exception& e) { 00070 PyErr_SetString(PyExc_ImportError, e.what()); 00071 return; 00072 } 00073 Py_InitModule3("Complete", Complete_methods, module_Complete_doc); /* mod name, table ptr */ 00074 Base::Console().Log("Loading Complete module... done\n"); 00075 } 00076 00077 } // extern "C"