From 2e19e5f6fbcb831732ae99624ca49b81ee8bf98a Mon Sep 17 00:00:00 2001 From: Aapo Date: Fri, 18 Nov 2022 01:01:01 +0200 Subject: [PATCH] [TD] DrawViewPart: Fix Dimension attachment on Cosmetic CenterLines upon document restore --- src/Mod/TechDraw/App/DrawViewPart.cpp | 29 ++++++++++++++++++++------- src/Mod/TechDraw/App/DrawViewPart.h | 1 + 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index 61c488235a..36901ffc7d 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -432,12 +432,8 @@ void DrawViewPart::postHlrTasks(void) addReferencesToGeom(); addShapes2d(); - //dimensions and balloons need to be recomputed here because their + //balloons need to be recomputed here because their //references will be invalid until the geometry exists - std::vector dims = getDimensions(); - for (auto& d : dims) { - d->recomputeFeature(); - } std::vector bals = getBalloons(); for (auto& b : bals) { b->recomputeFeature(); @@ -457,6 +453,24 @@ void DrawViewPart::postHlrTasks(void) requestPaint(); } +//run any tasks that need to been done after faces are available +void DrawViewPart::postFaceExtractionTasks(void) +{ + // Some centerlines depend on faces so we could not add CL geometry before now + addCenterLinesToGeom(); + + // Dimensions need to be recomputed here because their + // references will be invalid until all the geometry exists, + // specifically cosmetic centerlines + std::vector dims = getDimensions(); + for (auto& d : dims) { + d->recomputeFeature(); + } + + requestPaint(); +} + + //! make faces from the edge geometry void DrawViewPart::extractFaces() { @@ -662,8 +676,9 @@ void DrawViewPart::onFacesFinished(void) QObject::disconnect(connectFaceWatcher); showProgressMessage(getNameInDocument(), "has finished extracting faces"); - //some centerlines depend on faces so we could not add CL geometry before now - addCenterLinesToGeom(); + // Now we can recompute Dimensions and do other tasks possibly depending on Face extraction + postFaceExtractionTasks(); + requestPaint(); } diff --git a/src/Mod/TechDraw/App/DrawViewPart.h b/src/Mod/TechDraw/App/DrawViewPart.h index 7881aa3f18..c8536c4114 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.h +++ b/src/Mod/TechDraw/App/DrawViewPart.h @@ -173,6 +173,7 @@ public: double getSizeAlongVector(Base::Vector3d alignmentVector); virtual void postHlrTasks(void); + virtual void postFaceExtractionTasks(void); bool isIso() const;