Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tools
frackit
Commits
ebe8d7a9
Commit
ebe8d7a9
authored
May 26, 2020
by
Dennis Gläser
Browse files
[python][occ] add name to shape wrappers
parent
7fd65a49
Changes
2
Hide whitespace changes
Inline
Side-by-side
frackit/python/occutilities/brepwrapper.hh
View file @
ebe8d7a9
...
...
@@ -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
)
...
...
frackit/python/occutilities/brepwrappers.hh
View file @
ebe8d7a9
...
...
@@ -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"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment