Toposhape/Part: Transfer in FeatureFillet, FeatureChamfer and dependencies

This commit is contained in:
Zheng, Lei
2024-02-26 15:52:22 -05:00
committed by bgbsww
parent 9209331e59
commit 5da174f46e
6 changed files with 313 additions and 3 deletions

View File

@@ -48,13 +48,15 @@ App::DocumentObjectExecReturn *Fillet::execute()
if (!link)
return new App::DocumentObjectExecReturn("No object linked");
auto baseShape = Feature::getShape(link);
try {
#if defined(__GNUC__) && defined (FC_OS_LINUX)
Base::SignalException se;
#endif
auto baseShape = Feature::getShape(link);
TopoShape baseTopoShape = Feature::getTopoShape(link);
BRepFilletAPI_MakeFillet mkFillet(baseShape);
#ifndef FC_USE_TNP_FIX
TopTools_IndexedMapOfShape mapOfShape;
TopExp::MapShapes(baseShape, TopAbs_EDGE, mapOfShape);
@@ -92,6 +94,35 @@ App::DocumentObjectExecReturn *Fillet::execute()
prop.touch();
return App::DocumentObject::StdReturn;
#else
const auto &vals = EdgeLinks.getSubValues();
const auto &subs = EdgeLinks.getShadowSubs();
if(subs.size()!=(size_t)Edges.getSize())
return new App::DocumentObjectExecReturn("Edge link size mismatch");
size_t i=0;
for(const auto &info : Edges.getValues()) {
auto &sub = subs[i];
auto &ref = sub.first.size()?sub.first:vals[i];
++i;
TopoDS_Shape edge;
try {
edge = baseTopoShape.getSubShape(ref.c_str());
}catch(...){}
if(edge.IsNull())
return new App::DocumentObjectExecReturn("Invalid edge link");
double radius1 = info.radius1;
double radius2 = info.radius2;
mkFillet.Add(radius1, radius2, TopoDS::Edge(edge));
}
TopoDS_Shape shape = mkFillet.Shape();
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Resulting shape is null");
TopoShape res(0,getDocument()->getStringHasher());
this->Shape.setValue(res.makEShape(mkFillet,baseTopoShape,Part::OpCodes::Fillet));
return Part::Feature::execute();
#endif
}
catch (Standard_Failure& e) {
return new App::DocumentObjectExecReturn(e.GetMessageString());