[TD]Add pref for loose 2D objects

This commit is contained in:
wandererfan
2020-02-26 09:34:38 -05:00
committed by WandererFan
parent 33e87d5b2b
commit 233453c181
4 changed files with 226 additions and 193 deletions

View File

@@ -62,6 +62,9 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapes2d(const std::vector<App::Doc
// Base::Console().Message("SE::getShapes2d()\n");
std::vector<TopoDS_Shape> shapes2d;
if (!prefAdd2d()) {
return shapes2d;
}
for (auto& l:links) {
const App::GroupExtension* gex = dynamic_cast<const App::GroupExtension*>(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<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
bool result = hGrp->GetBool("ShowLoose2d", false);
return result;
}

View File

@@ -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:

View File

@@ -28,187 +28,7 @@
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" columnstretch="1,0,1">
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Edge End Cap</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::PrefCheckBox" name="cbDebugSection">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Dump intermediate results during Section processing</string>
</property>
<property name="text">
<string>Debug Section</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>debugSection</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/debug</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Max SVG Hatch Tiles</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::PrefCheckBox" name="cbFuseBeforeSection">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Perform a fuse operation on the input shape(s) before Section processing</string>
</property>
<property name="text">
<string>Fuse Before Section</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>SectionFuseFirst</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/General</cstring>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="Gui::PrefCheckBox" name="cbDebugDetail">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Dump intermediate results during Detail processing</string>
</property>
<property name="text">
<string>Debug Detail</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>debugDetail</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/debugDetail</cstring>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="Gui::PrefSpinBox" name="sbMaxTiles">
<property name="toolTip">
<string>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.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>10000</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>MaxSVGTile</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="Gui::PrefCheckBox" name="cbDetectFaces">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Detect Faces</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>HandleFaces</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/General</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="Gui::PrefCheckBox" name="cbCrazyEdges">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Include edges with unexpected geometry (zero length etc) to be included in results.</string>
</property>
<property name="text">
<string>Allow Crazy Edges</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>allowCrazyEdge</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/debug</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="Gui::PrefComboBox" name="cbEndCap">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -247,8 +67,21 @@ can be a performance penalty in complex models.</string>
</item>
</widget>
</item>
<item row="0" column="2">
<widget class="Gui::PrefCheckBox" name="cbShowSectionEdges">
<item row="2" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="Gui::PrefCheckBox" name="cbDebugDetail">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -256,27 +89,47 @@ can be a performance penalty in complex models.</string>
</sizepolicy>
</property>
<property name="toolTip">
<string>Highlights the border of the section cut in section views</string>
<string>Dump intermediate results during Detail processing</string>
</property>
<property name="text">
<string>Show Section Edges</string>
<string>Debug Detail</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowUnits</cstring>
<cstring>debugDetail</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Dimensions</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max PAT Hatch Segs</string>
<cstring>Mod/TechDraw/debugDetail</cstring>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="Gui::PrefSpinBox" name="sbMaxTiles">
<property name="toolTip">
<string>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.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>10000</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>MaxSVGTile</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="Gui::PrefSpinBox" name="sbMaxPat">
<property name="toolTip">
<string>Maximum hatch line segments to use
@@ -302,6 +155,172 @@ when hatching a face with a PAT pattern</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::PrefCheckBox" name="cbFuseBeforeSection">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Perform a fuse operation on the input shape(s) before Section processing</string>
</property>
<property name="text">
<string>Fuse Before Section</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>SectionFuseFirst</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/General</cstring>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="Gui::PrefCheckBox" name="cbShowSectionEdges">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Highlights the border of the section cut in section views</string>
</property>
<property name="text">
<string>Show Section Edges</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowUnits</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Dimensions</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::PrefCheckBox" name="cbDebugSection">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Dump intermediate results during Section processing</string>
</property>
<property name="text">
<string>Debug Section</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>debugSection</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/debug</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="Gui::PrefCheckBox" name="cbDetectFaces">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Detect Faces</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>HandleFaces</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/General</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Edge End Cap</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Max SVG Hatch Tiles</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max PAT Hatch Segs</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="Gui::PrefCheckBox" name="cbCrazyEdges">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Include edges with unexpected geometry (zero length etc) to be included in results.</string>
</property>
<property name="text">
<string>Allow Crazy Edges</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>allowCrazyEdge</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/debug</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="Gui::PrefCheckBox" name="cbShowLoose">
<property name="toolTip">
<string>Include 2d Objects in projection</string>
</property>
<property name="text">
<string>Show Loose 2D Geom</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowLoose2d</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/General</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -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();
}
/**