From 730136e3e9a347e205e3e8dee8f673fcbf21c1ac Mon Sep 17 00:00:00 2001 From: wandererfan Date: Fri, 22 Mar 2024 18:23:35 -0400 Subject: [PATCH] [TD]fix no PAT hatch on first paint --- src/Mod/TechDraw/App/DrawViewSection.cpp | 24 ++++++++++-------------- src/Mod/TechDraw/Gui/QGIViewSection.cpp | 12 +++++++----- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewSection.cpp b/src/Mod/TechDraw/App/DrawViewSection.cpp index 01ab923556..1b9a53695b 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.cpp +++ b/src/Mod/TechDraw/App/DrawViewSection.cpp @@ -385,7 +385,7 @@ TopoDS_Shape DrawViewSection::getShapeForDetail() const App::DocumentObjectExecReturn* DrawViewSection::execute() { - // Base::Console().Message("DVS::execute() - %s\n", getNameInDocument()); + // Base::Console().Message("DVS::execute() - %s\n", Label.getValue()); if (!keepUpdated()) { return App::DocumentObject::StdReturn; } @@ -445,9 +445,7 @@ bool DrawViewSection::isBaseValid() const void DrawViewSection::sectionExec(TopoDS_Shape& baseShape) { - // Base::Console().Message("DVS::sectionExec() - %s baseShape.IsNull: - // %d\n", - // getNameInDocument(), baseShape.IsNull()); + // Base::Console().Message("DVS::sectionExec() - %s baseShape.IsNull: %d\n", Label.getValue(), baseShape.IsNull()); if (waitingForHlr() || waitingForCut()) { return; @@ -486,9 +484,7 @@ void DrawViewSection::sectionExec(TopoDS_Shape& baseShape) void DrawViewSection::makeSectionCut(const TopoDS_Shape& baseShape) { - // Base::Console().Message("DVS::makeSectionCut() - %s - baseShape.IsNull: - // %d\n", - // getNameInDocument(), baseShape.IsNull()); + // Base::Console().Message("DVS::makeSectionCut() - %s - baseShape.IsNull:%d\n", Label.getValue(), baseShape.IsNull()); showProgressMessage(getNameInDocument(), "is making section cut"); @@ -638,8 +634,7 @@ void DrawViewSection::onSectionCutFinished() // activities that depend on updated geometry object void DrawViewSection::postHlrTasks(void) { - // Base::Console().Message("DVS::postHlrTasks() - %s\n", - // getNameInDocument()); + // Base::Console().Message("DVS::postHlrTasks() - %s\n", Label.getValue()); DrawViewPart::postHlrTasks(); @@ -1172,8 +1167,10 @@ gp_Ax2 DrawViewSection::getProjectionCS(const Base::Vector3d pt) const std::vector DrawViewSection::getDrawableLines(int i) { - // Base::Console().Message("DVS::getDrawableLines(%d) - lineSets: %d\n", i, - // m_lineSets.size()); + // Base::Console().Message("DVS::getDrawableLines(%d) - lineSets: %d\n", i, m_lineSets.size()); + if (m_lineSets.empty()) { + makeLineSets(); + } std::vector result; return DrawGeomHatch::getTrimmedLinesSection(this, m_lineSets, @@ -1236,7 +1233,7 @@ void DrawViewSection::setupObject() // create geometric hatch lines void DrawViewSection::makeLineSets(void) { - // Base::Console().Message("DVS::makeLineSets()\n"); + // Base::Console().Message("DVS::makeLineSets()\n"); if (PatIncluded.isEmpty()) { return; } @@ -1277,8 +1274,7 @@ void DrawViewSection::replaceSvgIncluded(std::string newSvgFile) void DrawViewSection::replacePatIncluded(std::string newPatFile) { - // Base::Console().Message("DVS::replacePatIncluded(%s)\n", - // newPatFile.c_str()); + // Base::Console().Message("DVS::replacePatIncluded(%s)\n", newPatFile.c_str()); if (newPatFile.empty()) { return; } diff --git a/src/Mod/TechDraw/Gui/QGIViewSection.cpp b/src/Mod/TechDraw/Gui/QGIViewSection.cpp index 07f90a1a1a..86a623fb2f 100644 --- a/src/Mod/TechDraw/Gui/QGIViewSection.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewSection.cpp @@ -47,6 +47,7 @@ void QGIViewSection::draw() void QGIViewSection::drawSectionFace() { + // Base::Console().Message("QGIVS::drawSectionFace()\n"); auto section( dynamic_cast(getViewObject()) ); if (!section) { return; @@ -85,13 +86,14 @@ void QGIViewSection::drawSectionFace() return; } - QColor faceColor = (sectionVp->CutSurfaceColor.getValue()).asValue(); - faceColor.setAlpha((100 - sectionVp->CutSurfaceTransparency.getValue())*255/100); - newFace->setFillColor(faceColor); - if (section->CutSurfaceDisplay.isValue("Color")) { + newFace->isHatched(true); + QColor faceColor = (sectionVp->CutSurfaceColor.getValue()).asValue(); + faceColor.setAlpha((100 - sectionVp->CutSurfaceTransparency.getValue())*255/100); + newFace->setFillColor(faceColor); newFace->setFillMode(faceColor.alpha() ? QGIFace::PlainFill : QGIFace::NoFill); } else if (section->CutSurfaceDisplay.isValue("SvgHatch")) { + newFace->isHatched(true); newFace->setFillMode(QGIFace::SvgFill); newFace->setHatchColor(sectionVp->HatchColor.getValue()); newFace->setHatchScale(section->HatchScale.getValue()); @@ -104,9 +106,9 @@ void QGIViewSection::drawSectionFace() newFace->setFillMode(QGIFace::GeomHatchFill); newFace->setHatchColor(sectionVp->GeomHatchColor.getValue()); newFace->setHatchScale(section->HatchScale.getValue()); - newFace->setLineWeight(sectionVp->WeightPattern.getValue()); newFace->setHatchRotation(section->HatchRotation.getValue()); newFace->setHatchOffset(section->HatchOffset.getValue()); + newFace->setLineWeight(sectionVp->WeightPattern.getValue()); std::vector lineSets = section->getDrawableLines(i); if (!lineSets.empty()) { newFace->clearLineSets();