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

Method transformShape

src/Mod/Measure/App/ShapeFinder.cpp:188–217  ·  view source on GitHub ↗

return inShape with placement and scaler applied. If inShape contains any infinite subshapes (such as Datum planes), the infinite shapes will not be included in the result.

Source from the content-addressed store, hash-verified

186//! return inShape with placement and scaler applied. If inShape contains any infinite subshapes
187//! (such as Datum planes), the infinite shapes will not be included in the result.
188TopoDS_Shape ShapeFinder::transformShape(
189 TopoDS_Shape& inShape,
190 const Base::Placement& placement,
191 const Base::Matrix4D& scaler
192)
193{
194 if (isShapeReallyNull(inShape)) {
195 return {};
196 }
197 // we modify the parameter shape here. we don't claim to be const, but may be better to copy
198 // the shape?
199 Part::TopoShape tshape {inShape};
200 if (tshape.isInfinite()) {
201 inShape = stripInfiniteShapes(inShape);
202 }
203
204 // copying the shape prevents "non-orthogonal GTrsf" errors in some versions
205 // of OCC. Something to do with triangulation of shape??
206 // it may be that incremental mesh would work here too.
207 BRepBuilderAPI_Copy copier(inShape);
208 tshape = Part::TopoShape(copier.Shape());
209 if (tshape.isNull()) {
210 return {};
211 }
212
213 tshape.transformShape(scaler, true, true);
214 tshape.setPlacement(placement);
215
216 return tshape.getShape();
217}
218
219
220//! this getter should work for any object, not just links

Callers

nothing calls this directly

Calls 6

TopoShapeClass · 0.50
isInfiniteMethod · 0.45
ShapeMethod · 0.45
isNullMethod · 0.45
setPlacementMethod · 0.45
getShapeMethod · 0.45

Tested by

no test coverage detected