Commit ebe8d7a9 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[python][occ] add name to shape wrappers

parent 7fd65a49
......@@ -29,6 +29,8 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Shape.hxx>
#include <frackit/geometryutilities/name.hh>
namespace Frackit::Python::OCCUtilities {
// Wrapper class to be used around occ brep classes
......@@ -41,6 +43,7 @@ public:
BRepWrapper(const Shape& shape) : shape_(shape) {}
const Shape& get() const { return shape_; }
std::string name() const { return geometryName(get()) + "_Wrapper"; }
private:
Shape shape_;
};
......@@ -72,6 +75,10 @@ public:
const Compound& get() const
{ return compound_; }
//! return the name of the wrapper class
std::string name() const
{ return "TopoDS_Compound_Wrapper"; }
//! add a wrapped shape to the compound
template<class ShapeWrapper>
void add(const ShapeWrapper& shape)
......
......@@ -33,6 +33,7 @@ namespace Detail {
{
using Wrapper = OCCUtilities::BRepWrapper<Shape>;
pybind11::class_<Wrapper> cls(module, className.c_str());
cls.def("name", &Wrapper::name, "return the name of the wrapper");
}
void registerCompoundWrapper(pybind11::module& module)
......@@ -43,6 +44,7 @@ namespace Detail {
// functions to add shapes to the compound
using namespace Frackit::Python::OCCUtilities;
cls.def("name", &Wrapper::name, "return the name of the wrapper");
cls.def("add", &Wrapper::add<ShapeWrapper>, "Add a shape to the compound");
cls.def("add", &Wrapper::add<VertexWrapper>, "Add a vertex to the compound");
cls.def("add", &Wrapper::add<EdgeWrapper>, "Add an edge to the compound");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment