Toposhape/Part: Transfer in replacEShape and removEShape
This commit is contained in:
@@ -1041,6 +1041,48 @@ public:
|
||||
double tol3d = 0.0,
|
||||
double tolBound = 0.0,
|
||||
double tolAngluar = 0.0);
|
||||
/* Make a shape with some subshapes replaced
|
||||
*
|
||||
* @param source: the source shape
|
||||
* @param s: replacement mapping the existing sub shape of source to new shapes
|
||||
*
|
||||
* @return The original content of this TopoShape is discarded and replaced
|
||||
* with the new shape. The function returns the TopoShape itself as
|
||||
* a self reference so that multiple operations can be carried out
|
||||
* for the same shape in the same line of code.
|
||||
*/
|
||||
TopoShape &replacEShape(const TopoShape &source, const std::vector<std::pair<TopoShape,TopoShape> > &s);
|
||||
/* Make a new shape using this shape with some subshapes replaced by others
|
||||
*
|
||||
* @param s: replacement mapping the existing sub shape of source to new shapes
|
||||
*
|
||||
* @return Return the new shape. The TopoShape itself is not modified.
|
||||
*/
|
||||
TopoShape replacEShape(const std::vector<std::pair<TopoShape,TopoShape> > &s) const {
|
||||
return TopoShape(0,Hasher).replacEShape(*this,s);
|
||||
}
|
||||
|
||||
/* Make a shape with some subshapes removed
|
||||
*
|
||||
* @param source: the source shape
|
||||
* @param s: the subshapes to be removed
|
||||
*
|
||||
* @return The original content of this TopoShape is discarded and replaced
|
||||
* with the new shape. The function returns the TopoShape itself as
|
||||
* a self reference so that multiple operations can be carried out
|
||||
* for the same shape in the same line of code.
|
||||
*/
|
||||
TopoShape &removEShape(const TopoShape &source, const std::vector<TopoShape>& s);
|
||||
/* Make a new shape using this shape with some subshapes removed
|
||||
*
|
||||
* @param s: the subshapes to be removed
|
||||
*
|
||||
* @return Return the new shape. The TopoShape itself is not modified.
|
||||
*/
|
||||
TopoShape removEShape(const std::vector<TopoShape>& s) const {
|
||||
return TopoShape(0,Hasher).removEShape(*this,s);
|
||||
}
|
||||
|
||||
|
||||
/** Make shape using generalized fusion and return the modified sub shapes
|
||||
*
|
||||
|
||||
@@ -3059,7 +3059,7 @@ TopoShape& TopoShape::makeElementSolid(const TopoShape& shape, const char* op)
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
TopoShape& TopoShape::makeElementMirror(const TopoShape& shape, const gp_Ax2& ax2, const char* op)
|
||||
{
|
||||
if (!op) {
|
||||
@@ -3108,6 +3108,41 @@ TopoShape& TopoShape::makeElementSlices(const TopoShape& shape,
|
||||
return makeElementCompound(wires, op, SingleShapeCompoundCreationPolicy::returnShape);
|
||||
}
|
||||
|
||||
TopoShape &TopoShape::replacEShape(const TopoShape &shape,
|
||||
const std::vector<std::pair<TopoShape,TopoShape> > &s)
|
||||
{
|
||||
if(shape.isNull())
|
||||
HANDLE_NULL_SHAPE;
|
||||
BRepTools_ReShape reshape;
|
||||
std::vector<TopoShape> shapes;
|
||||
shapes.reserve(s.size()+1);
|
||||
for (auto &v : s) {
|
||||
if(v.first.isNull() || v.second.isNull())
|
||||
HANDLE_NULL_INPUT;
|
||||
reshape.Replace(v.first.getShape(), v.second.getShape());
|
||||
shapes.push_back(v.second);
|
||||
}
|
||||
shapes.push_back(shape);
|
||||
setShape(reshape.Apply(shape.getShape(),TopAbs_SHAPE));
|
||||
mapSubElement(shapes);
|
||||
return *this;
|
||||
}
|
||||
|
||||
TopoShape &TopoShape::removEShape(const TopoShape &shape, const std::vector<TopoShape>& s)
|
||||
{
|
||||
if(shape.isNull())
|
||||
HANDLE_NULL_SHAPE;
|
||||
BRepTools_ReShape reshape;
|
||||
for(auto &sh : s) {
|
||||
if(sh.isNull())
|
||||
HANDLE_NULL_INPUT;
|
||||
reshape.Remove(sh.getShape());
|
||||
}
|
||||
setShape(reshape.Apply(shape.getShape(), TopAbs_SHAPE));
|
||||
mapSubElement(shape);
|
||||
return *this;
|
||||
}
|
||||
|
||||
TopoShape& TopoShape::makeElementFillet(const TopoShape& shape,
|
||||
const std::vector<TopoShape>& edges,
|
||||
double radius1,
|
||||
|
||||
Reference in New Issue
Block a user