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

Method makeSectionLineWire

src/Mod/TechDraw/App/DrawComplexSection.cpp:703–735  ·  view source on GitHub ↗

make a wire suitable for projection on a base view

Source from the content-addressed store, hash-verified

701
702//make a wire suitable for projection on a base view
703TopoDS_Wire DrawComplexSection::makeSectionLineWire()
704{
705 TopoDS_Wire lineWire;
706 App::DocumentObject* toolObj = CuttingToolWireObject.getValue();
707 auto* baseDvp = freecad_cast<DrawViewPart*>(BaseView.getValue());
708 if (baseDvp) {
709 TopoDS_Shape toolShape = Part::Feature::getShape(toolObj, Part::ShapeOption::ResolveLink | Part::ShapeOption::Transform);
710 if (toolShape.IsNull()) {
711 // CuttingToolWireObject is likely still restoring and has no shape yet
712 return {};
713 }
714 Base::Vector3d centroid = baseDvp->getCurrentCentroid();
715 TopoDS_Shape sTrans =
716 ShapeUtils::ShapeUtils::moveShape(toolShape, centroid * -1.0);
717 TopoDS_Shape sScaled = ShapeUtils::scaleShape(sTrans, baseDvp->getScale());
718 //we don't mirror the scaled shape here as it will be mirrored by the projection
719
720 if (sScaled.ShapeType() == TopAbs_WIRE) {
721 lineWire = makeNoseToTailWire(sScaled);
722 }
723 else if (sScaled.ShapeType() == TopAbs_EDGE) {
724 TopoDS_Edge edge = TopoDS::Edge(sScaled);
725 lineWire = BRepBuilderAPI_MakeWire(edge).Wire();
726 }
727 else {
728 //probably can't happen as cut profile has been checked before this
729 Base::Console().warning("DCS::makeSectionLineGeometry - profile is type: %d\n",
730 static_cast<int>(sScaled.ShapeType()));
731 return {};
732 }
733 }
734 return lineWire;
735}
736
737
738//find the points where the section line changes direction, and the direction

Callers

nothing calls this directly

Calls 9

getShapeFunction · 0.85
getCurrentCentroidMethod · 0.80
WireMethod · 0.80
EdgeClass · 0.50
getValueMethod · 0.45
IsNullMethod · 0.45
getScaleMethod · 0.45
ShapeTypeMethod · 0.45
warningMethod · 0.45

Tested by

no test coverage detected