Toponaming/Part: Transfer in FeatureMirroring and FeatureOffset

This commit is contained in:
Zheng, Lei
2024-03-14 11:31:30 -04:00
committed by bgbsww
parent 9209331e59
commit d2ecccb622
2 changed files with 18 additions and 1 deletions

View File

@@ -256,6 +256,7 @@ App::DocumentObjectExecReturn *Mirroring::execute()
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));
#ifndef FC_USE_TNP_FIX
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());

View File

@@ -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<TopoShape::JoinType>(Join.getValue());
this->Shape.setValue(TopoShape(0).makeElementOffset(
shape,offset,tol,inter,self,mode,join,fill));
#endif
return App::DocumentObject::StdReturn;
}