Skip to content

Commit

Permalink
Part: expose BRepFeat_MakePrism to Python
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Oct 16, 2020
1 parent b33a120 commit e1b56f8
Show file tree
Hide file tree
Showing 5 changed files with 461 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Mod/Part/App/AppPart.cpp
Expand Up @@ -108,6 +108,7 @@
#include "Mod/Part/App/BRepOffsetAPI_MakeFillingPy.h"
#include "Mod/Part/App/PartFeaturePy.h"
#include "Mod/Part/App/AttachEnginePy.h"
#include <Mod/Part/App/BRepFeat/MakePrismPy.h>
#include <Mod/Part/App/Geom2d/ArcOfCircle2dPy.h>
#include <Mod/Part/App/Geom2d/ArcOfConic2dPy.h>
#include <Mod/Part/App/Geom2d/ArcOfEllipse2dPy.h>
Expand Down Expand Up @@ -376,6 +377,10 @@ PyMOD_INIT_FUNC(Part)
Base::Interpreter().addType(&Part::GeometryBoolExtensionPy ::Type,partModule,"GeometryBoolExtension");
Base::Interpreter().addType(&Part::GeometryDoubleExtensionPy ::Type,partModule,"GeometryDoubleExtension");

// BRepFeat package
PyObject* brepfeatModule(module.getAttr("BRepFeat").ptr());
Base::Interpreter().addType(&Part::MakePrismPy::Type,brepfeatModule,"MakePrism");

// BRepOffsetAPI package
PyObject* brepOffsetApiModule(module.getAttr("BRepOffsetAPI").ptr());
Base::Interpreter().addType(&Part::BRepOffsetAPI_MakePipeShellPy::Type,brepOffsetApiModule,"MakePipeShell");
Expand Down
13 changes: 13 additions & 0 deletions src/Mod/Part/App/AppPartPy.cpp
Expand Up @@ -271,6 +271,17 @@ PartExport std::list<TopoDS_Edge> sort_Edges(double tol3d, std::list<TopoDS_Edge
}

namespace Part {
class BRepFeatModule : public Py::ExtensionModule<BRepFeatModule>
{
public:
BRepFeatModule() : Py::ExtensionModule<BRepFeatModule>("BRepFeat")
{
initialize("This is a module working with the BRepFeat package."); // register with Python
}

virtual ~BRepFeatModule() {}
};

class BRepOffsetAPIModule : public Py::ExtensionModule<BRepOffsetAPIModule>
{
public:
Expand Down Expand Up @@ -317,6 +328,7 @@ class ShapeUpgradeModule : public Py::ExtensionModule<ShapeUpgradeModule>

class Module : public Py::ExtensionModule<Module>
{
BRepFeatModule brepFeat;
BRepOffsetAPIModule brepOffsetApi;
Geom2dModule geom2d;
GeomPlateModule geomPlate;
Expand Down Expand Up @@ -537,6 +549,7 @@ class Module : public Py::ExtensionModule<Module>
);
initialize("This is a module working with shapes."); // register with Python

PyModule_AddObject(m_module, "BRepFeat", brepFeat.module().ptr());
PyModule_AddObject(m_module, "BRepOffsetAPI", brepOffsetApi.module().ptr());
PyModule_AddObject(m_module, "Geom2d", geom2d.module().ptr());
PyModule_AddObject(m_module, "GeomPlate", geomPlate.module().ptr());
Expand Down
100 changes: 100 additions & 0 deletions src/Mod/Part/App/BRepFeat/MakePrismPy.xml
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="PyObjectBase"
Name="MakePrismPy"
PythonName="Part.BRepFeat.MakePrism"
Twin="BRepFeat_MakePrism"
TwinPointer="BRepFeat_MakePrism"
Include="BRepFeat_MakePrism.hxx"
Namespace="Part"
FatherInclude="Base/PyObjectBase.h"
FatherNamespace="Base"
Constructor="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="Werner Mayer" EMail="wmayer[at]users.sourceforge.net" />
<UserDocu>Describes functions to build prism features.</UserDocu>
</Documentation>
<Methode Name="init" Keyword="true">
<Documentation>
<UserDocu>
Initializes this algorithm for building prisms along surfaces.
A face Pbase is selected in the shape Sbase
to serve as the basis for the prism. The orientation
of the prism will be defined by the vector Direction.

Fuse offers a choice between:
- removing matter with a Boolean cut using the setting 0
- adding matter with Boolean fusion using the setting 1.
The sketch face Skface serves to determine
the type of operation. If it is inside the basis
shape, a local operation such as glueing can be performed.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="add" Keyword="true">
<Documentation>
<UserDocu>
Indicates that the edge will slide on the face.
Raises ConstructionError if the face does not belong to the
basis shape, or the edge to the prismed shape.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="perform" Keyword="true">
<Documentation>
<UserDocu></UserDocu>
</Documentation>
</Methode>
<Methode Name="performUntilEnd">
<Documentation>
<UserDocu>
Realizes a semi-infinite prism, limited by the
position of the prism base. All other faces extend infinitely.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="performFromEnd">
<Documentation>
<UserDocu>
Realizes a semi-infinite prism, limited by the face Funtil.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="performThruAll">
<Documentation>
<UserDocu>
Builds an infinite prism. The infinite descendants will not be kept in the result.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="performUntilHeight">
<Documentation>
<UserDocu>
Assigns both a limiting shape, Until from TopoDS_Shape
and a height, Length at which to stop generation of the prism feature.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="curves" Const="true">
<Documentation>
<UserDocu>
Returns the list of curves S parallel to the axis of the prism.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="barycCurve" Const="true">
<Documentation>
<UserDocu>
Generates a curve along the center of mass of the primitive.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="shape" Const="true">
<Documentation>
<UserDocu>Returns a shape built by the shape construction algorithm.</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

0 comments on commit e1b56f8

Please sign in to comment.