From d2ecccb622bca0b805edd40a6a2c6631d164e35a Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Thu, 14 Mar 2024 11:31:30 -0400 Subject: [PATCH] Toponaming/Part: Transfer in FeatureMirroring and FeatureOffset --- src/Mod/Part/App/FeatureMirroring.cpp | 8 ++++++++ src/Mod/Part/App/FeatureOffset.cpp | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/App/FeatureMirroring.cpp b/src/Mod/Part/App/FeatureMirroring.cpp index 9cd077c72c..6513c4470d 100644 --- a/src/Mod/Part/App/FeatureMirroring.cpp +++ b/src/Mod/Part/App/FeatureMirroring.cpp @@ -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()); diff --git a/src/Mod/Part/App/FeatureOffset.cpp b/src/Mod/Part/App/FeatureOffset.cpp index 095d75dd49..59f6c6e641 100644 --- a/src/Mod/Part/App/FeatureOffset.cpp +++ b/src/Mod/Part/App/FeatureOffset.cpp @@ -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(Join.getValue()); + this->Shape.setValue(TopoShape(0).makeElementOffset( + shape,offset,tol,inter,self,mode,join,fill)); +#endif return App::DocumentObject::StdReturn; }