make a wire suitable for projection on a base view
| 701 | |
| 702 | //make a wire suitable for projection on a base view |
| 703 | TopoDS_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 |