FreeCAD
1// SPDX-License-Identifier: LGPL-2.1-or-later
2/****************************************************************************
3* *
4* Copyright (c) 2023 Ondsel <development@ondsel.com> *
5* *
6* This file is part of FreeCAD. *
7* *
8* FreeCAD is free software: you can redistribute it and/or modify it *
9* under the terms of the GNU Lesser General Public License as *
10* published by the Free Software Foundation, either version 2.1 of the *
11* License, or (at your option) any later version. *
12* *
13* FreeCAD is distributed in the hope that it will be useful, but *
14* WITHOUT ANY WARRANTY; without even the implied warranty of *
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16* Lesser General Public License for more details. *
17* *
18* You should have received a copy of the GNU Lesser General Public *
19* License along with FreeCAD. If not, see *
20* <https://www.gnu.org/licenses/>. *
21* *
22***************************************************************************/
23
24#include "PreCompiled.h"25
26#include <Base/Console.h>27#include <Base/Interpreter.h>28#include <Base/PyObjectBase.h>29
30#include "AssemblyObject.h"31#include "JointGroup.h"32
33
34namespace Assembly35{
36extern PyObject* initModule();37}
38
39/* Python entry */
40PyMOD_INIT_FUNC(AssemblyApp)41{
42// load dependent module43try {44Base::Interpreter().runString("import Part");45}46catch (const Base::Exception& e) {47PyErr_SetString(PyExc_ImportError, e.what());48PyMOD_Return(nullptr);49}50
51PyObject* mod = Assembly::initModule();52Base::Console().Log("Loading Assembly module... done\n");53
54
55// NOTE: To finish the initialization of our own type objects we must56// call PyType_Ready, otherwise we run into a segmentation fault, later on.57// This function is responsible for adding inherited slots from a type's base class.58
59Assembly::AssemblyObject ::init();60Assembly::JointGroup ::init();61
62PyMOD_Return(mod);63}
64