diff --git a/src/Mod/TechDraw/App/DrawComplexSection.cpp b/src/Mod/TechDraw/App/DrawComplexSection.cpp index 6fde6bec10..b7ed22d80c 100644 --- a/src/Mod/TechDraw/App/DrawComplexSection.cpp +++ b/src/Mod/TechDraw/App/DrawComplexSection.cpp @@ -795,9 +795,14 @@ TopoDS_Wire DrawComplexSection::makeSectionLineWire() App::DocumentObject* toolObj = CuttingToolWireObject.getValue(); DrawViewPart* baseDvp = dynamic_cast(BaseView.getValue()); if (baseDvp) { + TopoDS_Shape toolShape = Part::Feature::getShape(toolObj); + if (toolShape.IsNull()) { + // CuttingToolWireObject is likely still restoring and has no shape yet + return {}; + } Base::Vector3d centroid = baseDvp->getCurrentCentroid(); TopoDS_Shape sTrans = - ShapeUtils::ShapeUtils::moveShape(Part::Feature::getShape(toolObj), centroid * -1.0); + ShapeUtils::ShapeUtils::moveShape(toolShape, centroid * -1.0); TopoDS_Shape sScaled = ShapeUtils::scaleShape(sTrans, baseDvp->getScale()); //we don't mirror the scaled shape here as it will be mirrored by the projection diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index 6b0092698b..45a85407b5 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -148,6 +148,19 @@ void QGIViewPart::updateView(bool update) void QGIViewPart::draw() { + auto viewPart(dynamic_cast(getViewObject())); + if (!viewPart) { + return; + } + + auto doc = viewPart->getDocument(); + if (!doc || doc->testStatus(App::Document::Status::Restoring)) { + // if the document is still restoring, we may not have all the information + // we need to draw the source objects, so we wait until restore is finished. + // Base::Console().Message("QGIVP::draw - document is restoring, do not draw\n"); + return; + } + if (!isVisible()) return; @@ -697,6 +710,7 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b void QGIViewPart::drawComplexSectionLine(TechDraw::DrawViewSection* viewSection, bool b) { Q_UNUSED(b); + TechDraw::DrawViewPart* viewPart = static_cast(getViewObject()); if (!viewPart) return;