From c940081de1cb87f7e5bc724de220490231518c6c Mon Sep 17 00:00:00 2001 From: wandererfan Date: Thu, 21 Feb 2019 12:13:45 -0500 Subject: [PATCH] Allow Section of unfused Source - ViewSection required Source shapes to be fused before performing the section cut. This caused some Edges to not be shown in the result. An option to not fuse the Sources has been added. --- src/Mod/TechDraw/App/DrawViewSection.cpp | 16 ++++++++++++++-- src/Mod/TechDraw/App/DrawViewSection.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewSection.cpp b/src/Mod/TechDraw/App/DrawViewSection.cpp index c11e11299b..208fa34202 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.cpp +++ b/src/Mod/TechDraw/App/DrawViewSection.cpp @@ -106,7 +106,6 @@ DrawViewSection::DrawViewSection() static const char *sgroup = "Section"; static const char *fgroup = "Cut Surface Format"; - ADD_PROPERTY_TYPE(SectionSymbol ,("A"),sgroup,App::Prop_None,"The identifier for this section"); ADD_PROPERTY_TYPE(BaseView ,(0),sgroup,App::Prop_None,"2D View source for this Section"); BaseView.setScope(App::LinkScope::Global); @@ -114,6 +113,7 @@ DrawViewSection::DrawViewSection() ADD_PROPERTY_TYPE(SectionOrigin ,(0,0,0) ,sgroup,App::Prop_None,"Section Plane Origin"); SectionDirection.setEnums(SectionDirEnums); ADD_PROPERTY_TYPE(SectionDirection,((long)0),sgroup, App::Prop_None, "Direction in Base View for this Section"); + ADD_PROPERTY_TYPE(FuseBeforeCut ,(false),sgroup,App::Prop_None,"Merge Source(s) into a single shape before cutting"); ADD_PROPERTY_TYPE(FileHatchPattern ,(""),fgroup,App::Prop_None,"The hatch pattern file for the cut surface"); ADD_PROPERTY_TYPE(NameGeomPattern ,(""),fgroup,App::Prop_None,"The pattern name for geometric hatching"); @@ -196,7 +196,13 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void) if (!base->getTypeId().isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) return new App::DocumentObjectExecReturn("BaseView object is not a DrawViewPart object"); - TopoDS_Shape baseShape = static_cast(base)->getSourceShapeFused(); + TopoDS_Shape baseShape; + if (FuseBeforeCut.getValue()) { + baseShape = static_cast(base)->getSourceShapeFused(); + } else { + baseShape = static_cast(base)->getSourceShape(); + } + if (baseShape.IsNull()) { Base::Console().Log("DVS::execute - baseShape is Null\n"); return new App::DocumentObjectExecReturn("BaseView Source object is Null"); @@ -619,6 +625,12 @@ void DrawViewSection::getParameters() } std::string patternName = hGrp->GetASCII("PatternName","Diamond"); NameGeomPattern.setValue(patternName); + + hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General"); + + bool fuseFirst = hGrp->GetBool("SectionFuseFirst",true); + FuseBeforeCut.setValue(fuseFirst); } // Python Drawing feature --------------------------------------------------------- diff --git a/src/Mod/TechDraw/App/DrawViewSection.h b/src/Mod/TechDraw/App/DrawViewSection.h index de28b28a1f..ddd0bcf8a6 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.h +++ b/src/Mod/TechDraw/App/DrawViewSection.h @@ -69,6 +69,7 @@ public: App::PropertyString NameGeomPattern; App::PropertyFloat HatchScale; App::PropertyString SectionSymbol; + App::PropertyBool FuseBeforeCut; virtual short mustExecute() const;