Toponaming/Part: Clean and add tests for FeatureMirroring and FeatureOffset

This commit is contained in:
bgbsww
2024-03-15 08:09:34 -04:00
parent b4bb92465f
commit 7a520a4ea6
6 changed files with 295 additions and 8 deletions

View File

@@ -252,11 +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));
#ifndef FC_USE_TNP_FIX
gp_Trsf mat;
mat.SetMirror(ax2);
TopLoc_Location loc = shape.Location();
@@ -266,9 +266,9 @@ App::DocumentObjectExecReturn *Mirroring::execute()
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");
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

View File

@@ -95,9 +95,9 @@ App::DocumentObjectExecReturn *Offset::execute()
auto shape = Feature::getTopoShape(source);
if(shape.isNull())
return new App::DocumentObjectExecReturn("Invalid source link");
auto join = static_cast<TopoShape::JoinType>(Join.getValue());
auto join = static_cast<JoinType>(Join.getValue());
this->Shape.setValue(TopoShape(0).makeElementOffset(
shape,offset,tol,inter,self,mode,join,fill));
shape,offset,tol,inter,self,mode,join,fill ? FillType::fill : FillType::noFill));
#endif
return App::DocumentObject::StdReturn;
}