From 233453c1813f8538f02a15803591dae0383fbf64 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Wed, 26 Feb 2020 09:34:38 -0500 Subject: [PATCH] [TD]Add pref for loose 2D objects --- src/Mod/TechDraw/App/ShapeExtractor.cpp | 11 + src/Mod/TechDraw/App/ShapeExtractor.h | 1 + src/Mod/TechDraw/Gui/DlgPrefsTechDraw4.ui | 405 +++++++++--------- src/Mod/TechDraw/Gui/DlgPrefsTechDraw4Imp.cpp | 2 + 4 files changed, 226 insertions(+), 193 deletions(-) diff --git a/src/Mod/TechDraw/App/ShapeExtractor.cpp b/src/Mod/TechDraw/App/ShapeExtractor.cpp index 09063c2604..40029f0589 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.cpp +++ b/src/Mod/TechDraw/App/ShapeExtractor.cpp @@ -62,6 +62,9 @@ std::vector ShapeExtractor::getShapes2d(const std::vector shapes2d; + if (!prefAdd2d()) { + return shapes2d; + } for (auto& l:links) { const App::GroupExtension* gex = dynamic_cast(l); // App::Property* gProp = l->getPropertyByName("Group"); @@ -341,3 +344,11 @@ Base::Vector3d ShapeExtractor::getLocation3dFromFeat(App::DocumentObject* obj) return result; } +bool ShapeExtractor::prefAdd2d(void) +{ + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General"); + bool result = hGrp->GetBool("ShowLoose2d", false); + return result; +} + diff --git a/src/Mod/TechDraw/App/ShapeExtractor.h b/src/Mod/TechDraw/App/ShapeExtractor.h index a544824047..ae163d675a 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.h +++ b/src/Mod/TechDraw/App/ShapeExtractor.h @@ -55,6 +55,7 @@ public: static bool isPointType(App::DocumentObject* obj); static bool isDraftPoint(App::DocumentObject* obj); static Base::Vector3d getLocation3dFromFeat(App::DocumentObject* obj); + static bool prefAdd2d(void); protected: diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw4.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDraw4.ui index ea800f1244..837a3736c5 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw4.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDraw4.ui @@ -28,187 +28,7 @@ - - - - - true - - - - Edge End Cap - - - - - - - - 0 - 0 - - - - Dump intermediate results during Section processing - - - Debug Section - - - debugSection - - - Mod/TechDraw/debug - - - - - - - Max SVG Hatch Tiles - - - - - - - - 0 - 0 - - - - - true - - - - Perform a fuse operation on the input shape(s) before Section processing - - - Fuse Before Section - - - SectionFuseFirst - - - Mod/TechDraw/General - - - - - - - - 0 - 0 - - - - Dump intermediate results during Detail processing - - - Debug Detail - - - debugDetail - - - Mod/TechDraw/debugDetail - - - - - - Limit of 64x64 pixel SVG tiles used to hatch a single face. -For large scalings you might get an error about to many SVG tiles. -Then you need to increase the tile limit. - - - 1 - - - 1000000 - - - 100 - - - 10000 - - - MaxSVGTile - - - Mod/TechDraw/Decorations - - - - - - - - 0 - 0 - - - - If checked, TechDraw will attempt to build faces using the -line segments returned by the hidden line removal algorithm. -Faces must be detected in order to use hatching, but there -can be a performance penalty in complex models. - - - Detect Faces - - - true - - - HandleFaces - - - /Mod/TechDraw/General - - - - - - - - 0 - 0 - - - - Include edges with unexpected geometry (zero length etc) to be included in results. - - - Allow Crazy Edges - - - allowCrazyEdge - - - Mod/TechDraw/debug - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - @@ -247,8 +67,21 @@ can be a performance penalty in complex models. - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + 0 @@ -256,27 +89,47 @@ can be a performance penalty in complex models. - Highlights the border of the section cut in section views + Dump intermediate results during Detail processing - Show Section Edges + Debug Detail - ShowUnits + debugDetail - /Mod/TechDraw/Dimensions - - - - - - - Max PAT Hatch Segs + Mod/TechDraw/debugDetail + + + Limit of 64x64 pixel SVG tiles used to hatch a single face. +For large scalings you might get an error about to many SVG tiles. +Then you need to increase the tile limit. + + + 1 + + + 1000000 + + + 100 + + + 10000 + + + MaxSVGTile + + + Mod/TechDraw/Decorations + + + + Maximum hatch line segments to use @@ -302,6 +155,172 @@ when hatching a face with a PAT pattern + + + + + 0 + 0 + + + + + true + + + + Perform a fuse operation on the input shape(s) before Section processing + + + Fuse Before Section + + + SectionFuseFirst + + + Mod/TechDraw/General + + + + + + + + 0 + 0 + + + + Highlights the border of the section cut in section views + + + Show Section Edges + + + ShowUnits + + + /Mod/TechDraw/Dimensions + + + + + + + + 0 + 0 + + + + Dump intermediate results during Section processing + + + Debug Section + + + debugSection + + + Mod/TechDraw/debug + + + + + + + + 0 + 0 + + + + If checked, TechDraw will attempt to build faces using the +line segments returned by the hidden line removal algorithm. +Faces must be detected in order to use hatching, but there +can be a performance penalty in complex models. + + + Detect Faces + + + true + + + HandleFaces + + + /Mod/TechDraw/General + + + + + + + + true + + + + Edge End Cap + + + + + + + Max SVG Hatch Tiles + + + + + + + Max PAT Hatch Segs + + + + + + + + 0 + 0 + + + + Include edges with unexpected geometry (zero length etc) to be included in results. + + + Allow Crazy Edges + + + allowCrazyEdge + + + Mod/TechDraw/debug + + + + + + + Include 2d Objects in projection + + + Show Loose 2D Geom + + + false + + + ShowLoose2d + + + Mod/TechDraw/General + + + diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw4Imp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDraw4Imp.cpp index 7ade224bc3..8ea42d7b5e 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw4Imp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDraw4Imp.cpp @@ -52,6 +52,7 @@ void DlgPrefsTechDraw4Imp::saveSettings() cbFuseBeforeSection->onSave(); sbMaxTiles->onSave(); sbMaxPat->onSave(); + cbShowLoose->onSave(); } void DlgPrefsTechDraw4Imp::loadSettings() @@ -65,6 +66,7 @@ void DlgPrefsTechDraw4Imp::loadSettings() cbFuseBeforeSection->onRestore(); sbMaxTiles->onRestore(); sbMaxPat->onRestore(); + cbShowLoose->onRestore(); } /**