Part: expose ShapeFix_SplitCommonVertex to Python
This commit is contained in:
@@ -107,6 +107,7 @@
|
||||
#include <Mod/Part/App/ShapeFix/ShapeFix_ShapePy.h>
|
||||
#include <Mod/Part/App/ShapeFix/ShapeFix_ShellPy.h>
|
||||
#include <Mod/Part/App/ShapeFix/ShapeFix_SolidPy.h>
|
||||
#include <Mod/Part/App/ShapeFix/ShapeFix_SplitCommonVertexPy.h>
|
||||
#include <Mod/Part/App/ShapeFix/ShapeFix_WirePy.h>
|
||||
#include <Mod/Part/App/ShapeUpgrade/UnifySameDomainPy.h>
|
||||
#include "Mod/Part/App/SpherePy.h"
|
||||
@@ -355,6 +356,7 @@ PyMOD_INIT_FUNC(Part)
|
||||
Base::Interpreter().addType(&Part::ShapeFix_SolidPy::Type, shapeFix, "Solid");
|
||||
Base::Interpreter().addType(&Part::ShapeFix_WirePy::Type, shapeFix, "Wire");
|
||||
Base::Interpreter().addType(&Part::ShapeFix_EdgeConnectPy::Type, shapeFix, "EdgeConnect");
|
||||
Base::Interpreter().addType(&Part::ShapeFix_SplitCommonVertexPy::Type, shapeFix, "SplitCommonVertex");
|
||||
|
||||
// ShapeUpgrade sub-module
|
||||
PyObject* shapeUpgrade(module.getAttr("ShapeUpgrade").ptr());
|
||||
|
||||
@@ -144,6 +144,7 @@ generate_from_xml(ShapeFix/ShapeFix_ShellPy)
|
||||
generate_from_xml(ShapeFix/ShapeFix_SolidPy)
|
||||
generate_from_xml(ShapeFix/ShapeFix_WirePy)
|
||||
generate_from_xml(ShapeFix/ShapeFix_EdgeConnectPy)
|
||||
generate_from_xml(ShapeFix/ShapeFix_SplitCommonVertexPy)
|
||||
|
||||
generate_from_xml(ShapeUpgrade/UnifySameDomainPy)
|
||||
|
||||
@@ -445,6 +446,8 @@ SET(ShapeFixPy_SRCS
|
||||
ShapeFix/ShapeFix_WirePyImp.cpp
|
||||
ShapeFix/ShapeFix_EdgeConnectPy.xml
|
||||
ShapeFix/ShapeFix_EdgeConnectPyImp.cpp
|
||||
ShapeFix/ShapeFix_SplitCommonVertexPy.xml
|
||||
ShapeFix/ShapeFix_SplitCommonVertexPyImp.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP("ShapeFix" FILES ${ShapeFixPy_SRCS})
|
||||
|
||||
34
src/Mod/Part/App/ShapeFix/ShapeFix_SplitCommonVertexPy.xml
Normal file
34
src/Mod/Part/App/ShapeFix/ShapeFix_SplitCommonVertexPy.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
Father="ShapeFix_RootPy"
|
||||
Name="ShapeFix_SplitCommonVertexPy"
|
||||
PythonName="Part.ShapeFix.SplitCommonVertex"
|
||||
Twin="ShapeFix_SplitCommonVertex"
|
||||
TwinPointer="ShapeFix_SplitCommonVertex"
|
||||
Include="ShapeFix_SplitCommonVertex.hxx"
|
||||
Namespace="Part"
|
||||
FatherInclude="Mod/Part/App/ShapeFix/ShapeFix_RootPy.h"
|
||||
FatherNamespace="Part"
|
||||
Constructor="true">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Werner Mayer" EMail="wmayer@users.sourceforge.net" />
|
||||
<UserDocu>Class for fixing operations on shapes</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="init">
|
||||
<Documentation>
|
||||
<UserDocu>Initializes by shape</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="perform">
|
||||
<Documentation>
|
||||
<UserDocu>Iterates on sub- shape and performs fixes</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="shape">
|
||||
<Documentation>
|
||||
<UserDocu>Returns resulting shape</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
103
src/Mod/Part/App/ShapeFix/ShapeFix_SplitCommonVertexPyImp.cpp
Normal file
103
src/Mod/Part/App/ShapeFix/ShapeFix_SplitCommonVertexPyImp.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <TopoDS.hxx>
|
||||
#endif
|
||||
|
||||
#include "ShapeFix/ShapeFix_SplitCommonVertexPy.h"
|
||||
#include "ShapeFix/ShapeFix_SplitCommonVertexPy.cpp"
|
||||
#include "ShapeFix/ShapeFix_EdgePy.h"
|
||||
#include "ShapeFix/ShapeFix_WirePy.h"
|
||||
#include "ShapeFix/ShapeFix_FacePy.h"
|
||||
#include "ShapeFix/ShapeFix_ShellPy.h"
|
||||
#include "ShapeFix/ShapeFix_SolidPy.h"
|
||||
#include <Mod/Part/App/TopoShapePy.h>
|
||||
|
||||
using namespace Part;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string ShapeFix_SplitCommonVertexPy::representation() const
|
||||
{
|
||||
return "<ShapeFix_SplitCommonVertex object>";
|
||||
}
|
||||
|
||||
PyObject *ShapeFix_SplitCommonVertexPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
{
|
||||
// create a new instance of ShapeFix_ShapePy
|
||||
return new ShapeFix_SplitCommonVertexPy(nullptr);
|
||||
}
|
||||
|
||||
// constructor method
|
||||
int ShapeFix_SplitCommonVertexPy::PyInit(PyObject* args, PyObject* /*kwds*/)
|
||||
{
|
||||
PyObject* shape = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "|O!", &TopoShapePy::Type, &shape))
|
||||
return -1;
|
||||
|
||||
setHandle(new ShapeFix_SplitCommonVertex);
|
||||
if (shape) {
|
||||
getShapeFix_SplitCommonVertexPtr()->Init(static_cast<TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject* ShapeFix_SplitCommonVertexPy::init(PyObject *args)
|
||||
{
|
||||
PyObject* shape;
|
||||
if (!PyArg_ParseTuple(args, "O!", &TopoShapePy::Type, &shape))
|
||||
return nullptr;
|
||||
|
||||
getShapeFix_SplitCommonVertexPtr()->Init(static_cast<TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* ShapeFix_SplitCommonVertexPy::perform(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
getShapeFix_SplitCommonVertexPtr()->Perform();
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* ShapeFix_SplitCommonVertexPy::shape(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
TopoShape shape = getShapeFix_SplitCommonVertexPtr()->Shape();
|
||||
return shape.getPyObject();
|
||||
}
|
||||
|
||||
PyObject *ShapeFix_SplitCommonVertexPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int ShapeFix_SplitCommonVertexPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user