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

@@ -53,7 +53,7 @@ App::DocumentObjectExecReturn *Chamfer::execute()
TopTools_IndexedDataMapOfShapeListOfShape mapEdgeFace;
TopExp::MapShapesAndAncestors(baseShape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
TopExp::MapShapes(baseShape, TopAbs_EDGE, mapOfEdges);
#ifndef FC_USE_TNP_FIX
std::vector<FilletElement> values = Edges.getValues();
for (const auto & value : values) {
int id = value.edgeid;
@@ -89,6 +89,36 @@ App::DocumentObjectExecReturn *Chamfer::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;
const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First());
mkChamfer.Add(radius1, radius2, TopoDS::Edge(edge), face);
}
TopoDS_Shape shape = mkChamfer.Shape();
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Resulting shape is null");
TopoShape res(0,getDocument()->getStringHasher());
this->Shape.setValue(res.makEShape(mkChamfer,baseTopoShape,Part::OpCodes::Chamfer));
return Part::Feature::execute();
#endif
}
catch (Standard_Failure& e) {
return new App::DocumentObjectExecReturn(e.GetMessageString());