FreeCAD

Форк
0
/
AppMesh.cpp 
116 строк · 4.9 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net>     *
3
 *                                                                         *
4
 *   This file is part of the FreeCAD CAx development system.              *
5
 *                                                                         *
6
 *   This library is free software; you can redistribute it and/or         *
7
 *   modify it under the terms of the GNU Library General Public           *
8
 *   License as published by the Free Software Foundation; either          *
9
 *   version 2 of the License, or (at your option) any later version.      *
10
 *                                                                         *
11
 *   This library  is distributed in the hope that it will be useful,      *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 *   GNU Library General Public License for more details.                  *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU Library General Public     *
17
 *   License along with this library; see the file COPYING.LIB. If not,    *
18
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
19
 *   Suite 330, Boston, MA  02111-1307, USA                                *
20
 *                                                                         *
21
 ***************************************************************************/
22

23
#include "PreCompiled.h"
24

25
#include <App/Application.h>
26
#include <Base/Console.h>
27
#include <Base/Interpreter.h>
28

29
#include "EdgePy.h"
30
#include "Exporter.h"
31
#include "FacetPy.h"
32
#include "FeatureMeshCurvature.h"
33
#include "FeatureMeshDefects.h"
34
#include "FeatureMeshExport.h"
35
#include "FeatureMeshImport.h"
36
#include "FeatureMeshSegmentByMesh.h"
37
#include "FeatureMeshSetOperations.h"
38
#include "FeatureMeshSolid.h"
39
#include "FeatureMeshTransform.h"
40
#include "FeatureMeshTransformDemolding.h"
41
#include "Mesh.h"
42
#include "MeshFeaturePy.h"
43
#include "MeshPointPy.h"
44
#include "MeshPy.h"
45

46

47
namespace Mesh
48
{
49
extern PyObject* initModule();
50
}
51

52
/* Python entry */
53
PyMOD_INIT_FUNC(Mesh)
54
{
55
    PyObject* meshModule = Mesh::initModule();
56
    Base::Console().Log("Loading Mesh module... done\n");
57

58
    // NOTE: To finish the initialization of our own type objects we must
59
    // call PyType_Ready, otherwise we run into a segmentation fault, later on.
60
    // This function is responsible for adding inherited slots from a type's base class.
61
    ParameterGrp::handle handle = App::GetApplication().GetParameterGroupByPath(
62
        "User parameter:BaseApp/Preferences/Mod/Mesh");
63
    ParameterGrp::handle asy = handle->GetGroup("Asymptote");
64
    MeshCore::MeshOutput::SetAsymptoteSize(asy->GetASCII("Width", "500"), asy->GetASCII("Height"));
65

66
    // clang-format off
67
    // add mesh elements
68
    Base::Interpreter().addType(&Mesh::MeshPointPy  ::Type,meshModule,"MeshPoint");
69
    Base::Interpreter().addType(&Mesh::EdgePy       ::Type,meshModule,"Edge");
70
    Base::Interpreter().addType(&Mesh::FacetPy      ::Type,meshModule,"Facet");
71
    Base::Interpreter().addType(&Mesh::MeshPy       ::Type,meshModule,"Mesh");
72
    Base::Interpreter().addType(&Mesh::MeshFeaturePy::Type,meshModule,"Feature");
73

74
    Mesh::Extension3MFFactory::addProducer(new Mesh::GuiExtension3MFProducer);
75

76
    // init Type system
77
    Mesh::PropertyNormalList    ::init();
78
    Mesh::PropertyCurvatureList ::init();
79
    Mesh::PropertyMaterial      ::init();
80
    Mesh::PropertyMeshKernel    ::init();
81

82
    Mesh::MeshObject            ::init();
83
    Mesh::MeshSegment           ::init();
84

85
    Mesh::Feature               ::init();
86
    Mesh::FeatureCustom         ::init();
87
    Mesh::FeaturePython         ::init();
88
    Mesh::Import                ::init();
89
    Mesh::Export                ::init();
90
    Mesh::Transform             ::init();
91
    Mesh::TransformDemolding    ::init();
92
    Mesh::Curvature             ::init();
93
    Mesh::SegmentByMesh         ::init();
94
    Mesh::SetOperations         ::init();
95
    Mesh::FixDefects            ::init();
96
    Mesh::HarmonizeNormals      ::init();
97
    Mesh::FlipNormals           ::init();
98
    Mesh::FixNonManifolds       ::init();
99
    Mesh::FixDuplicatedFaces    ::init();
100
    Mesh::FixDuplicatedPoints   ::init();
101
    Mesh::FixDegenerations      ::init();
102
    Mesh::FixDeformations       ::init();
103
    Mesh::FixIndices            ::init();
104
    Mesh::FillHoles             ::init();
105
    Mesh::RemoveComponents      ::init();
106

107
    Mesh::Sphere                ::init();
108
    Mesh::Ellipsoid             ::init();
109
    Mesh::Cylinder              ::init();
110
    Mesh::Cone                  ::init();
111
    Mesh::Torus                 ::init();
112
    Mesh::Cube                  ::init();
113
    // clang-format on
114

115
    PyMOD_Return(meshModule);
116
}
117

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

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

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

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