Part: Extended makePipeShell() so it accepts a transformation mode value

This commit is contained in:
Yorik van Havre 2013-10-07 15:41:38 -03:00
parent cdea437e37
commit ced0a2b6d0
4 changed files with 19 additions and 5 deletions

View File

@ -1347,7 +1347,8 @@ TopoDS_Shape TopoShape::makePipe(const TopoDS_Shape& profile) const
TopoDS_Shape TopoShape::makePipeShell(const TopTools_ListOfShape& profiles,
const Standard_Boolean make_solid,
const Standard_Boolean isFrenet) const
const Standard_Boolean isFrenet,
int transition) const
{
if (this->_Shape.IsNull())
Standard_Failure::Raise("Cannot sweep along empty spine");
@ -1355,7 +1356,17 @@ TopoDS_Shape TopoShape::makePipeShell(const TopTools_ListOfShape& profiles,
Standard_Failure::Raise("Spine shape is not a wire");
BRepOffsetAPI_MakePipeShell mkPipeShell(TopoDS::Wire(this->_Shape));
BRepBuilderAPI_TransitionMode transMode;
switch (transition) {
case 1: transMode = BRepBuilderAPI_RightCorner;
break;
case 2: transMode = BRepBuilderAPI_RoundCorner;
break;
default: transMode = BRepBuilderAPI_Transformed;
break;
}
mkPipeShell.SetMode(isFrenet);
mkPipeShell.SetTransitionMode(transMode);
TopTools_ListIteratorOfListOfShape it;
for (it.Initialize(profiles); it.More(); it.Next()) {
mkPipeShell.Add(TopoDS_Shape(it.Value()));

View File

@ -155,7 +155,7 @@ public:
//@{
TopoDS_Shape makePipe(const TopoDS_Shape& profile) const;
TopoDS_Shape makePipeShell(const TopTools_ListOfShape& profiles, const Standard_Boolean make_solid,
const Standard_Boolean isFrenet = Standard_False) const;
const Standard_Boolean isFrenet = Standard_False, int transition=0) const;
TopoDS_Shape makePrism(const gp_Vec&) const;
TopoDS_Shape revolve(const gp_Ax1&, double d) const;
TopoDS_Shape makeSweep(const TopoDS_Shape& profile, double, int) const;

View File

@ -41,7 +41,9 @@
</Methode>
<Methode Name="makePipeShell">
<Documentation>
<UserDocu>Make a loft defined by profiles along a wire.</UserDocu>
<UserDocu>makePipeShell(shapeList,[isSolid,isFrenet,transition])
Make a loft defined by a list of profiles along a wire. Transition can be
0 (default), 1 (right corners) or 2 (rounded corners).</UserDocu>
</Documentation>
</Methode>
<Methode Name="approximate">

View File

@ -244,8 +244,9 @@ PyObject* TopoShapeWirePy::makePipeShell(PyObject *args)
PyObject *obj;
int make_solid = 0;
int is_Frenet = 0;
int transition = 0;
if (PyArg_ParseTuple(args, "O!|ii", &(PyList_Type), &obj, &make_solid, &is_Frenet)) {
if (PyArg_ParseTuple(args, "O!|iii", &(PyList_Type), &obj, &make_solid, &is_Frenet, &transition)) {
try {
TopTools_ListOfShape sections;
Py::List list(obj);
@ -255,7 +256,7 @@ PyObject* TopoShapeWirePy::makePipeShell(PyObject *args)
sections.Append(shape);
}
}
TopoDS_Shape shape = this->getTopoShapePtr()->makePipeShell(sections, make_solid, is_Frenet);
TopoDS_Shape shape = this->getTopoShapePtr()->makePipeShell(sections, make_solid, is_Frenet, transition);
return new TopoShapePy(new TopoShape(shape));
}
catch (Standard_Failure) {