23
#include "PreCompiled.h"
25
# include <BRepFilletAPI_MakeFillet.hxx>
26
# include <Precision.hxx>
28
# include <TopExp_Explorer.hxx>
30
# include <TopoDS_Edge.hxx>
31
# include <TopTools_IndexedMapOfShape.hxx>
34
#include <Base/Exception.h>
36
#include "FeatureFillet.h"
37
#include "TopoShapeOpCode.h"
42
PROPERTY_SOURCE(Part::Fillet, Part::FilletBase)
44
Fillet::Fillet() = default;
46
App::DocumentObjectExecReturn *Fillet::execute()
48
App::DocumentObject* link = Base.getValue();
50
return new App::DocumentObjectExecReturn("No object linked");
54
#if defined(__GNUC__) && defined (FC_OS_LINUX)
55
Base::SignalException se;
57
auto baseShape = Feature::getShape(link);
58
TopoShape baseTopoShape = Feature::getTopoShape(link);
59
BRepFilletAPI_MakeFillet mkFillet(baseShape);
60
TopTools_IndexedMapOfShape mapOfShape;
61
TopExp::MapShapes(baseShape, TopAbs_EDGE, mapOfShape);
62
TopTools_IndexedMapOfShape mapOfEdges;
63
TopExp::MapShapes(baseShape, TopAbs_EDGE, mapOfEdges);
64
const auto &vals = EdgeLinks.getSubValues();
65
const auto &subs = EdgeLinks.getShadowSubs();
66
if(subs.size()!=(size_t)Edges.getSize())
67
return new App::DocumentObjectExecReturn("Edge link size mismatch");
69
for(const auto &info : Edges.getValues()) {
71
auto &ref = sub.newName.size()?sub.newName:vals[i];
78
auto id = Data::MappedName(ref.c_str()).toIndexedName().getIndex();
79
const TopoDS_Edge& edge = TopoDS::Edge(mapOfEdges.FindKey(id));
81
return new App::DocumentObjectExecReturn("Invalid edge link");
82
double radius1 = info.radius1;
83
double radius2 = info.radius2;
84
mkFillet.Add(radius1, radius2, TopoDS::Edge(edge));
87
TopoDS_Shape shape = mkFillet.Shape();
89
return new App::DocumentObjectExecReturn("Resulting shape is null");
92
this->Shape.setValue(res.makeElementShape(mkFillet,baseTopoShape,Part::OpCodes::Fillet));
93
return Part::Feature::execute();
95
catch (Standard_Failure& e) {
96
return new App::DocumentObjectExecReturn(e.GetMessageString());
99
return new App::DocumentObjectExecReturn("A fatal error occurred when making fillets");