AppMesh.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net>     *
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 "Mesh.h"
00033 #include "MeshPy.h"
00034 #include "MeshPointPy.h"
00035 #include "FacetPy.h"
00036 #include "MeshFeaturePy.h"
00037 #include "FeatureMeshImport.h"
00038 #include "FeatureMeshExport.h"
00039 #include "FeatureMeshTransform.h"
00040 #include "FeatureMeshTransformDemolding.h"
00041 #include "FeatureMeshCurvature.h"
00042 #include "FeatureMeshSegmentByMesh.h"
00043 #include "FeatureMeshSetOperations.h"
00044 #include "FeatureMeshDefects.h"
00045 #include "FeatureMeshSolid.h"
00046 
00047 /* registration table  */
00048 extern struct PyMethodDef Mesh_Import_methods[];
00049 
00050 
00051 PyDoc_STRVAR(module_doc,
00052 "The functions in this module allow working with mesh objects.\n"
00053 "A set of functions are provided that allow to read in registered mesh file formats\n"
00054 "to either an newly created or already exising document.\n"
00055 "\n"
00056 "open(string) -- Create a new document and a Mesh::Import feature to load the file into the document.\n"
00057 "insert(string, string) -- Create a Mesh::Import feature to load the file into the given document.\n"
00058 "mesh() -- Create an empty mesh object.\n"
00059 "\n");
00060 
00061 /* Python entry */
00062 extern "C" {
00063 void MeshExport initMesh() 
00064 {
00065     PyObject* meshModule = Py_InitModule3("Mesh", Mesh_Import_methods, module_doc);   /* mod name, table ptr */
00066     Base::Console().Log("Loading Mesh module... done\n");
00067 
00068     // NOTE: To finish the initialization of our own type objects we must
00069     // call PyType_Ready, otherwise we run into a segmentation fault, later on.
00070     // This function is responsible for adding inherited slots from a type's base class.
00071 
00072     // add mesh elements
00073     Base::Interpreter().addType(&Mesh::MeshPointPy  ::Type,meshModule,"MeshPoint");
00074     Base::Interpreter().addType(&Mesh::FacetPy      ::Type,meshModule,"Facet");
00075     Base::Interpreter().addType(&Mesh::MeshPy       ::Type,meshModule,"Mesh");
00076     Base::Interpreter().addType(&Mesh::MeshFeaturePy::Type,meshModule,"Feature");
00077 
00078     // init Type system
00079     Mesh::PropertyNormalList    ::init();
00080     Mesh::PropertyCurvatureList ::init();
00081     Mesh::PropertyMeshKernel    ::init();
00082 
00083     Mesh::MeshObject            ::init();
00084 
00085     Mesh::Feature               ::init();
00086     Mesh::FeaturePython         ::init();
00087     Mesh::Import                ::init();
00088     Mesh::Export                ::init();
00089     Mesh::Transform             ::init();
00090     Mesh::TransformDemolding    ::init();
00091     Mesh::Curvature             ::init();
00092     Mesh::SegmentByMesh         ::init();
00093     Mesh::SetOperations         ::init();
00094     Mesh::FixDefects            ::init();
00095     Mesh::HarmonizeNormals      ::init();
00096     Mesh::FlipNormals           ::init();
00097     Mesh::FixNonManifolds       ::init();
00098     Mesh::FixDuplicatedFaces    ::init();
00099     Mesh::FixDuplicatedPoints   ::init();
00100     Mesh::FixDegenerations      ::init();
00101     Mesh::FixDeformations       ::init();
00102     Mesh::FixIndices            ::init();
00103     Mesh::FillHoles             ::init();
00104     Mesh::RemoveComponents      ::init();
00105 
00106     Mesh::Sphere                ::init();
00107     Mesh::Ellipsoid             ::init();
00108     Mesh::Cylinder              ::init();
00109     Mesh::Cone                  ::init();
00110     Mesh::Torus                 ::init();
00111     Mesh::Cube                  ::init();
00112 }
00113 
00114 
00115 } // extern "C" 

Generated on Wed Nov 23 18:59:56 2011 for FreeCAD by  doxygen 1.6.1