Merge pull request #12982 from bgbsww/bgbsww-toponamingFeatureMirroring
Toponaming/Part feature mirroring and offset
This commit is contained in:
@@ -252,10 +252,11 @@ App::DocumentObjectExecReturn *Mirroring::execute()
|
||||
Base::Vector3d norm = Normal.getValue();
|
||||
|
||||
try {
|
||||
gp_Ax2 ax2(gp_Pnt(base.x,base.y,base.z), gp_Dir(norm.x,norm.y,norm.z));
|
||||
#ifndef FC_USE_TNP_FIX
|
||||
const TopoDS_Shape& shape = Feature::getShape(link);
|
||||
if (shape.IsNull())
|
||||
Standard_Failure::Raise(std::string(std::string(this->getFullLabel()) + ": Cannot mirror empty shape").c_str());
|
||||
gp_Ax2 ax2(gp_Pnt(base.x,base.y,base.z), gp_Dir(norm.x,norm.y,norm.z));
|
||||
gp_Trsf mat;
|
||||
mat.SetMirror(ax2);
|
||||
TopLoc_Location loc = shape.Location();
|
||||
@@ -264,6 +265,13 @@ App::DocumentObjectExecReturn *Mirroring::execute()
|
||||
BRepBuilderAPI_Transform mkTrf(shape, mat);
|
||||
this->Shape.setValue(mkTrf.Shape());
|
||||
return App::DocumentObject::StdReturn;
|
||||
#else
|
||||
auto shape = Feature::getTopoShape(link);
|
||||
if (shape.isNull())
|
||||
Standard_Failure::Raise("Cannot mirror empty shape");
|
||||
this->Shape.setValue(TopoShape(0).makeElementMirror(shape,ax2));
|
||||
return Part::Feature::execute();
|
||||
#endif
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
return new App::DocumentObjectExecReturn(e.GetMessageString());
|
||||
|
||||
@@ -83,13 +83,22 @@ App::DocumentObjectExecReturn *Offset::execute()
|
||||
bool inter = Intersection.getValue();
|
||||
bool self = SelfIntersection.getValue();
|
||||
short mode = (short)Mode.getValue();
|
||||
short join = (short)Join.getValue();
|
||||
bool fill = Fill.getValue();
|
||||
#ifndef FC_USE_TNP_FIX
|
||||
short join = (short)Join.getValue();
|
||||
const TopoShape& shape = Feature::getShape(source);
|
||||
if (fabs(offset) > 2*tol)
|
||||
this->Shape.setValue(shape.makeOffsetShape(offset, tol, inter, self, mode, join, fill));
|
||||
else
|
||||
this->Shape.setValue(shape);
|
||||
#else
|
||||
auto shape = Feature::getTopoShape(source);
|
||||
if(shape.isNull())
|
||||
return new App::DocumentObjectExecReturn("Invalid source link");
|
||||
auto join = static_cast<JoinType>(Join.getValue());
|
||||
this->Shape.setValue(TopoShape(0).makeElementOffset(
|
||||
shape,offset,tol,inter,self,mode,join,fill ? FillType::fill : FillType::noFill));
|
||||
#endif
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user