MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / execute

Method execute

src/Mod/Part/App/PartFeatures.cpp:128–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128App::DocumentObjectExecReturn* RuledSurface::execute()
129{
130 try {
131 std::vector<TopoShape> shapes;
132 std::array<App::PropertyLinkSub*, 2> links = {&Curve1, &Curve2};
133 for (auto link : links) {
134 App::DocumentObject* obj = link->getValue();
135 const Part::TopoShape part
136 = Part::Feature::getTopoShape(obj, ShapeOption::ResolveLink | ShapeOption::Transform);
137 if (part.isNull()) {
138 return new App::DocumentObjectExecReturn("No shape linked.");
139 }
140 // if no explicit sub-shape is selected use the whole part
141 const auto& subs = link->getSubValues();
142 if (subs.empty()) {
143 shapes.push_back(part);
144 }
145 else if (subs.size() != 1) {
146 return new App::DocumentObjectExecReturn("Not exactly one sub-shape linked.");
147 }
148 else {
149 shapes.push_back(getTopoShape(
150 link->getValue(),
151 ShapeOption::NeedSubElement | ShapeOption::ResolveLink | ShapeOption::Transform,
152 subs.front().c_str()
153 ));
154 }
155 if (shapes.back().isNull()) {
156 return new App::DocumentObjectExecReturn("Invalid link.");
157 }
158 }
159 TopoShape res(0, getDocument()->getStringHasher());
160 res.makeElementRuledSurface(shapes, Orientation.getValue());
161 this->Shape.setValue(res);
162 return Part::Feature::execute();
163 }
164 catch (Standard_Failure& e) {
165
166 return new App::DocumentObjectExecReturn(e.GetMessageString());
167 }
168 catch (...) {
169 return new App::DocumentObjectExecReturn("General error in RuledSurface::execute()");
170 }
171}
172
173// ----------------------------------------------------------------------------
174

Callers

nothing calls this directly

Calls 15

getSubValuesMethod · 0.80
getStringHasherMethod · 0.80
linearizeMethod · 0.80
getSubTopoShapeMethod · 0.80
fromMatrixMethod · 0.80
TopoShapeClass · 0.70
getDocumentFunction · 0.50
executeFunction · 0.50
getValueMethod · 0.45
isNullMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected