+ Projection of edges and wires

This commit is contained in:
wmayer 2014-01-12 18:48:55 +01:00
parent 1e135aa367
commit 0f6ccf11bf
2 changed files with 55 additions and 0 deletions

View File

@ -307,6 +307,16 @@ Orientation is not taken into account.</UserDocu>
<UserDocu>Project a shape on this shape</UserDocu> <UserDocu>Project a shape on this shape</UserDocu>
</Documentation> </Documentation>
</Methode> </Methode>
<Methode Name="makeCylindricalProjection" Const="true">
<Documentation>
<UserDocu>Cylindrical projection of an edge or wire on this shape</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeConicalProjection" Const="true">
<Documentation>
<UserDocu>Conical projection of an edge or wire on this shape</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeShapeFromMesh"> <Methode Name="makeShapeFromMesh">
<Documentation> <Documentation>
<UserDocu>Make a compund shape out of mesh data. <UserDocu>Make a compund shape out of mesh data.

View File

@ -32,6 +32,7 @@
# include <BRepFilletAPI_MakeChamfer.hxx> # include <BRepFilletAPI_MakeChamfer.hxx>
# include <BRepOffsetAPI_MakePipe.hxx> # include <BRepOffsetAPI_MakePipe.hxx>
# include <BRepOffsetAPI_MakePipeShell.hxx> # include <BRepOffsetAPI_MakePipeShell.hxx>
# include <BRepProj_Projection.hxx>
# include <BRepTools.hxx> # include <BRepTools.hxx>
# include <gp_Ax1.hxx> # include <gp_Ax1.hxx>
# include <gp_Ax2.hxx> # include <gp_Ax2.hxx>
@ -1273,6 +1274,50 @@ PyObject* TopoShapePy::project(PyObject *args)
return 0; return 0;
} }
PyObject* TopoShapePy::makeCylindricalProjection(PyObject *args)
{
PyObject *pShape, *pDir;
if (PyArg_ParseTuple(args, "O!O!", &(Part::TopoShapePy::Type), &pShape, &Base::VectorPy::Type, &pDir)) {
try {
const TopoDS_Shape& shape = this->getTopoShapePtr()->_Shape;
const TopoDS_Shape& wire = static_cast<TopoShapePy*>(pShape)->getTopoShapePtr()->_Shape;
Base::Vector3d vec = Py::Vector(pDir,false).toVector();
BRepProj_Projection proj(wire, shape, gp_Dir(vec.x,vec.y,vec.z));
TopoDS_Shape projected = proj.Shape();
return new TopoShapePy(new TopoShape(projected));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return 0;
}
}
return 0;
}
PyObject* TopoShapePy::makeConicalProjection(PyObject *args)
{
PyObject *pShape, *pDir;
if (PyArg_ParseTuple(args, "O!O!", &(Part::TopoShapePy::Type), &pShape, &Base::VectorPy::Type, &pDir)) {
try {
const TopoDS_Shape& shape = this->getTopoShapePtr()->_Shape;
const TopoDS_Shape& wire = static_cast<TopoShapePy*>(pShape)->getTopoShapePtr()->_Shape;
Base::Vector3d vec = Py::Vector(pDir,false).toVector();
BRepProj_Projection proj(wire, shape, gp_Pnt(vec.x,vec.y,vec.z));
TopoDS_Shape projected = proj.Shape();
return new TopoShapePy(new TopoShape(projected));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return 0;
}
}
return 0;
}
PyObject* TopoShapePy::makeShapeFromMesh(PyObject *args) PyObject* TopoShapePy::makeShapeFromMesh(PyObject *args)
{ {
PyObject *tup; PyObject *tup;