FreeCAD

Форк
0
/
AppAssembly.cpp 
63 строки · 2.6 Кб
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

34
namespace Assembly
35
{
36
extern PyObject* initModule();
37
}
38

39
/* Python entry */
40
PyMOD_INIT_FUNC(AssemblyApp)
41
{
42
    // load dependent module
43
    try {
44
        Base::Interpreter().runString("import Part");
45
    }
46
    catch (const Base::Exception& e) {
47
        PyErr_SetString(PyExc_ImportError, e.what());
48
        PyMOD_Return(nullptr);
49
    }
50

51
    PyObject* mod = Assembly::initModule();
52
    Base::Console().Log("Loading Assembly module... done\n");
53

54

55
    // NOTE: To finish the initialization of our own type objects we must
56
    // 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

59
    Assembly::AssemblyObject ::init();
60
    Assembly::JointGroup ::init();
61

62
    PyMOD_Return(mod);
63
}
64

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.