Make more consistent method names in TopoShape
This commit is contained in:
parent
95c5dfad8a
commit
aee645ee9d
|
@ -1690,21 +1690,98 @@ TopoDS_Shape TopoShape::revolve(const gp_Ax1& axis, double d) const
|
|||
return mkRevol.Shape();
|
||||
}
|
||||
|
||||
TopoDS_Shape TopoShape::makeThickSolid(const TopTools_ListOfShape& remFace,
|
||||
Standard_Real offset, Standard_Real tolerance) const
|
||||
{
|
||||
BRepOffsetAPI_MakeThickSolid mkThick(this->_Shape, remFace, offset, tolerance);
|
||||
return mkThick.Shape();
|
||||
}
|
||||
#include <BRepFill.hxx>
|
||||
#include <BRepTools_Quilt.hxx>
|
||||
|
||||
TopoDS_Shape TopoShape::makeOffset(double offset, double tol, bool intersection,
|
||||
bool selfInter, short offsetMode, short join)
|
||||
TopoDS_Shape TopoShape::makeOffsetShape(double offset, double tol, bool intersection,
|
||||
bool selfInter, short offsetMode, short join,
|
||||
bool fill) const
|
||||
{
|
||||
BRepOffsetAPI_MakeOffsetShape mkOffset(this->_Shape, offset, tol, BRepOffset_Mode(offsetMode),
|
||||
intersection ? Standard_True : Standard_False,
|
||||
selfInter ? Standard_True : Standard_False,
|
||||
GeomAbs_JoinType(join));
|
||||
return mkOffset.Shape();
|
||||
const TopoDS_Shape& res = mkOffset.Shape();
|
||||
if (!fill)
|
||||
return res;
|
||||
#if 0
|
||||
const BRepOffset_MakeOffset& off = mkOffset.MakeOffset();
|
||||
const BRepAlgo_Image& img = off.OffsetEdgesFromShapes();
|
||||
|
||||
// build up map edge->face
|
||||
TopTools_IndexedDataMapOfShapeListOfShape edge2Face;
|
||||
TopExp::MapShapesAndAncestors(this->_Shape, TopAbs_EDGE, TopAbs_FACE, edge2Face);
|
||||
TopTools_IndexedMapOfShape mapOfShape;
|
||||
TopExp::MapShapes(this->_Shape, TopAbs_EDGE, mapOfShape);
|
||||
|
||||
TopoDS_Shell shell;
|
||||
BRep_Builder builder;
|
||||
TopExp_Explorer xp;
|
||||
builder.MakeShell(shell);
|
||||
|
||||
for (xp.Init(this->_Shape,TopAbs_FACE); xp.More(); xp.Next()) {
|
||||
builder.Add(shell, xp.Current());
|
||||
}
|
||||
|
||||
for (int i=1; i<= edge2Face.Extent(); ++i) {
|
||||
const TopTools_ListOfShape& los = edge2Face.FindFromIndex(i);
|
||||
if (los.Extent() == 1) {
|
||||
// set the index value as user data to use it in accept()
|
||||
const TopoDS_Shape& edge = edge2Face.FindKey(i);
|
||||
Standard_Boolean ok = img.HasImage(edge);
|
||||
if (ok) {
|
||||
const TopTools_ListOfShape& edges = img.Image(edge);
|
||||
TopTools_ListIteratorOfListOfShape it;
|
||||
it.Initialize(edges);
|
||||
TopoDS_Face face = BRepFill::Face(TopoDS::Edge(edge), TopoDS::Edge(it.Value()));
|
||||
builder.Add(shell, face);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (xp.Init(mkOffset.Shape(),TopAbs_FACE); xp.More(); xp.Next()) {
|
||||
builder.Add(shell, xp.Current());
|
||||
}
|
||||
|
||||
//BRepBuilderAPI_Sewing sew(offset);
|
||||
//sew.Load(this->_Shape);
|
||||
//sew.Add(mkOffset.Shape());
|
||||
//sew.Perform();
|
||||
|
||||
//shell.Closed(Standard_True);
|
||||
|
||||
return shell;
|
||||
#else
|
||||
TopoDS_Solid Res;
|
||||
TopExp_Explorer exp;
|
||||
BRep_Builder B;
|
||||
B.MakeSolid(Res);
|
||||
|
||||
BRepTools_Quilt Glue;
|
||||
for (exp.Init(this->_Shape,TopAbs_FACE); exp.More(); exp.Next()) {
|
||||
Glue.Add (exp.Current());
|
||||
}
|
||||
for (exp.Init(mkOffset.Shape(),TopAbs_FACE);exp.More(); exp.Next()) {
|
||||
Glue.Add (exp.Current().Reversed());
|
||||
}
|
||||
TopoDS_Shape S = Glue.Shells();
|
||||
for (exp.Init(S,TopAbs_SHELL); exp.More(); exp.Next()) {
|
||||
B.Add(Res,exp.Current());
|
||||
}
|
||||
Res.Closed(Standard_True);
|
||||
return Res;
|
||||
#endif
|
||||
}
|
||||
|
||||
TopoDS_Shape TopoShape::makeThickSolid(const TopTools_ListOfShape& remFace,
|
||||
double offset, double tol, bool intersection,
|
||||
bool selfInter, short offsetMode, short join) const
|
||||
{
|
||||
BRepOffsetAPI_MakeThickSolid mkThick(this->_Shape, remFace, offset, tol, BRepOffset_Mode(offsetMode),
|
||||
intersection ? Standard_True : Standard_False,
|
||||
selfInter ? Standard_True : Standard_False,
|
||||
GeomAbs_JoinType(join));
|
||||
return mkThick.Shape();
|
||||
}
|
||||
|
||||
void TopoShape::transformGeometry(const Base::Matrix4D &rclMat)
|
||||
|
|
|
@ -158,8 +158,6 @@ public:
|
|||
const Standard_Boolean isFrenet = Standard_False) const;
|
||||
TopoDS_Shape makePrism(const gp_Vec&) const;
|
||||
TopoDS_Shape revolve(const gp_Ax1&, double d) const;
|
||||
TopoDS_Shape makeThickSolid(const TopTools_ListOfShape& remFace,
|
||||
Standard_Real offset, Standard_Real tolerance) const;
|
||||
TopoDS_Shape makeSweep(const TopoDS_Shape& profile, double, int) const;
|
||||
TopoDS_Shape makeTube(double radius, double tol, int cont, int maxdeg, int maxsegm) const;
|
||||
TopoDS_Shape makeHelix(Standard_Real pitch, Standard_Real height,
|
||||
|
@ -168,9 +166,13 @@ public:
|
|||
Standard_Real height, Standard_Real radius) const;
|
||||
TopoDS_Shape makeLoft(const TopTools_ListOfShape& profiles, Standard_Boolean isSolid,
|
||||
Standard_Boolean isRuled) const;
|
||||
TopoDS_Shape makeOffset(double offset, double tol,
|
||||
TopoDS_Shape makeOffsetShape(double offset, double tol,
|
||||
bool intersection = false, bool selfInter = false,
|
||||
short offsetMode = 0, short join = 0);
|
||||
short offsetMode = 0, short join = 0, bool fill = false) const;
|
||||
TopoDS_Shape makeThickSolid(const TopTools_ListOfShape& remFace,
|
||||
double offset, double tol,
|
||||
bool intersection = false, bool selfInter = false,
|
||||
short offsetMode = 0, short join = 0) const;
|
||||
//@}
|
||||
|
||||
/** @name Manipulation*/
|
||||
|
|
|
@ -189,7 +189,7 @@ the underlying geometry.</UserDocu>
|
|||
</Methode>
|
||||
<Methode Name="makeThickness" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>makeThickness(List of shapes, Ofset (Float), Tolerance (Float)) -> Shape
|
||||
<UserDocu>makeThickness(List of shapes, Offset (Float), Tolerance (Float)) -> Shape
|
||||
A hollowed solid is built from an initial solid and a set of faces on this solid,
|
||||
which are to be removed. The remaining faces of the solid become the walls of
|
||||
the hollowed solid, their thickness defined at the time of construction.</UserDocu>
|
||||
|
|
|
@ -1024,7 +1024,15 @@ PyObject* TopoShapePy::makeThickness(PyObject *args)
|
|||
{
|
||||
PyObject *obj;
|
||||
double offset, tolerance;
|
||||
if (!PyArg_ParseTuple(args, "O!dd", &(PyList_Type), &obj, &offset, &tolerance))
|
||||
PyObject* inter = Py_False;
|
||||
PyObject* self_inter = Py_False;
|
||||
short offsetMode = 0, join = 0;
|
||||
if (!PyArg_ParseTuple(args, "O!dd|O!O!hh",
|
||||
&(PyList_Type), &obj,
|
||||
&offset, &tolerance,
|
||||
&(PyBool_Type), &inter,
|
||||
&(PyBool_Type), &self_inter,
|
||||
&offsetMode, &join))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
|
@ -1037,7 +1045,8 @@ PyObject* TopoShapePy::makeThickness(PyObject *args)
|
|||
}
|
||||
}
|
||||
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->makeThickSolid(facesToRemove, offset, tolerance);
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->makeThickSolid(facesToRemove, offset, tolerance,
|
||||
(inter == Py_True), (self_inter == Py_True), offsetMode, join);
|
||||
return new TopoShapeSolidPy(new TopoShape(shape));
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
|
@ -1052,17 +1061,19 @@ PyObject* TopoShapePy::makeOffsetShape(PyObject *args)
|
|||
double offset, tolerance;
|
||||
PyObject* inter = Py_False;
|
||||
PyObject* self_inter = Py_False;
|
||||
PyObject* fill = Py_False;
|
||||
short offsetMode = 0, join = 0;
|
||||
if (!PyArg_ParseTuple(args, "dd|O!O!hh",
|
||||
if (!PyArg_ParseTuple(args, "dd|O!O!hhO!",
|
||||
&offset, &tolerance,
|
||||
&(PyBool_Type), &inter,
|
||||
&(PyBool_Type), &self_inter,
|
||||
&offsetMode, &join))
|
||||
&offsetMode, &join,
|
||||
&(PyBool_Type), &fill))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->makeOffset(offset, tolerance,
|
||||
(inter == Py_True), (self_inter == Py_True), offsetMode, join);
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->makeOffsetShape(offset, tolerance,
|
||||
(inter == Py_True), (self_inter == Py_True), offsetMode, join, (fill == Py_True));
|
||||
return new TopoShapePy(new TopoShape(shape));
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user