Part: add method to add a wire (e.g. to create a hole) to a face

This commit is contained in:
wmayer
2020-09-25 16:00:01 +02:00
parent da6cdb94a1
commit 7616153b3c
2 changed files with 44 additions and 0 deletions

View File

@@ -14,6 +14,11 @@
<Author Licence="LGPL" Name="Juergen Riegel" EMail="Juergen.Riegel@web.de" />
<UserDocu>TopoShapeFace is the OpenCasCade topological face wrapper</UserDocu>
</Documentation>
<Methode Name="addWire">
<Documentation>
<UserDocu>Adds a wire to the face.</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeOffset" Const="true">
<Documentation>
<UserDocu>Offset the face by a given amount. Returns Compound of Wires. Deprecated - use makeOffset2D instead.</UserDocu>

View File

@@ -374,6 +374,45 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
return -1;
}
/*!
* \brief TopoShapeFacePy::addWire
* \code
circle = Part.Circle()
circle.Radius = 10
wire = Part.Wire(circle.toShape())
Part.show(wire)
circle2 = Part.Circle()
circle2.Radius = 4
wire2 = Part.Wire(circle2.toShape())
Part.show(wire2)
plane = Part.Plane()
face = plane.toShape()
face.addWire(wire)
face.Area
Part.show(face)
face.addWire(wire2.reversed())
face.Area
Part.show(face)
* \endcode
*/
PyObject* TopoShapeFacePy::addWire(PyObject *args)
{
PyObject* wire;
if (!PyArg_ParseTuple(args, "O!", &TopoShapeWirePy::Type, &wire))
return nullptr;
BRep_Builder aBuilder;
TopoDS_Face face = TopoDS::Face(getTopoShapePtr()->getShape());
const TopoDS_Shape& shape = static_cast<TopoShapeWirePy*>(wire)->getTopoShapePtr()->getShape();
aBuilder.Add(face, shape);
getTopoShapePtr()->setShape(face);
Py_Return;
}
PyObject* TopoShapeFacePy::makeOffset(PyObject *args)
{
double dist;