Expose curve accuracy as a preference.
This commit is contained in:
committed by
Yorik van Havre
parent
375614a1f6
commit
e7a509306e
@@ -17,7 +17,7 @@
|
||||
<item>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
@@ -91,18 +91,28 @@
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="widget_5" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::InputField" name="geometryTolerance">
|
||||
<property name="toolTip">
|
||||
<string>Default value for new Jobs, used for computing Paths. Smaller increases accuracy, but slows down computation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Default Geometry Tolerance</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::InputField" name="geometryTolerance">
|
||||
<property name="toolTip">
|
||||
<string>Default value for new Jobs, used for computing Paths. Smaller increases accuracy, but slows down computation</string>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="curveAccuracy"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Default Curve Accuracy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -132,8 +142,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>422</width>
|
||||
<height>558</height>
|
||||
<width>406</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@@ -334,6 +344,14 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>422</width>
|
||||
<height>558</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Setup</string>
|
||||
</attribute>
|
||||
|
||||
@@ -29,3 +29,7 @@ ParGrp.SetString("HelpIndex", "Path/Help/index.html")
|
||||
ParGrp.SetString("WorkBenchName", "Path")
|
||||
ParGrp.SetString("WorkBenchModule", "PathWorkbench.py")
|
||||
|
||||
# Setup global default values
|
||||
import Path
|
||||
from PathScripts.PathPreferences import PathPreferences
|
||||
Path.Area.setDefaultParams(Accuracy = PathPreferences.defaultLibAreaCurveAccuracy())
|
||||
|
||||
@@ -42,7 +42,8 @@ class PathPreferences:
|
||||
PostProcessorOutputPolicy = "PostProcessorOutputPolicy"
|
||||
|
||||
# Linear tolerance to use when generating Paths, eg when tesselating geometry
|
||||
GeometryTolerance = "GeometryTolerance"
|
||||
GeometryTolerance = "GeometryTolerance"
|
||||
LibAreaCurveAccuracy = "LibAreaCurveAccuarcy"
|
||||
|
||||
@classmethod
|
||||
def preferences(cls):
|
||||
@@ -90,6 +91,10 @@ class PathPreferences:
|
||||
def defaultGeometryTolerance(cls):
|
||||
return cls.preferences().GetFloat(cls.GeometryTolerance, 0.01)
|
||||
|
||||
@classmethod
|
||||
def defaultLibAreaCurveAccuracy(cls):
|
||||
return cls.preferences().GetFloat(cls.LibAreaCurveAccuracy, 0.01)
|
||||
|
||||
@classmethod
|
||||
def defaultFilePath(cls):
|
||||
return cls.preferences().GetString(cls.DefaultFilePath)
|
||||
@@ -125,12 +130,13 @@ class PathPreferences:
|
||||
return ''
|
||||
|
||||
@classmethod
|
||||
def setJobDefaults(cls, filePath, jobTemplate, geometryTolerance):
|
||||
PathLog.track("(%s='%s', %s, %s)" % (cls.DefaultFilePath, filePath, jobTemplate, geometryTolerance))
|
||||
def setJobDefaults(cls, filePath, jobTemplate, geometryTolerance, curveAccuracy):
|
||||
PathLog.track("(%s='%s', %s, %s, %s)" % (cls.DefaultFilePath, filePath, jobTemplate, geometryTolerance, curveAccuracy))
|
||||
pref = cls.preferences()
|
||||
pref.SetString(cls.DefaultFilePath, filePath)
|
||||
pref.SetString(cls.DefaultJobTemplate, jobTemplate)
|
||||
pref.SetFloat(cls.GeometryTolerance, geometryTolerance)
|
||||
pref.SetFloat(cls.LibAreaCurveAccuracy, curveAccuracy)
|
||||
|
||||
@classmethod
|
||||
def postProcessorBlacklist(cls):
|
||||
|
||||
@@ -50,7 +50,8 @@ class JobPreferencesPage:
|
||||
filePath = self.form.leDefaultFilePath.text()
|
||||
jobTemplate = self.form.leDefaultJobTemplate.text()
|
||||
geometryTolerance = Units.Quantity(self.form.geometryTolerance.text())
|
||||
PathPreferences.setJobDefaults(filePath, jobTemplate, geometryTolerance)
|
||||
curveAccuracy = Units.Quantity(self.form.curveAccuracy.text())
|
||||
PathPreferences.setJobDefaults(filePath, jobTemplate, geometryTolerance, curveAccuracy)
|
||||
|
||||
processor = str(self.form.defaultPostProcessor.currentText())
|
||||
args = str(self.form.defaultPostProcessorArgs.text())
|
||||
@@ -148,6 +149,7 @@ class JobPreferencesPage:
|
||||
|
||||
geomTol = Units.Quantity(PathPreferences.defaultGeometryTolerance(), Units.Length)
|
||||
self.form.geometryTolerance.setText(geomTol.UserString)
|
||||
self.form.curveAccuracy.setText(Units.Quantity(PathPreferences.defaultLibAreaCurveAccuracy(), Units.Length).UserString)
|
||||
|
||||
self.form.leOutputFile.setText(PathPreferences.defaultOutputFile())
|
||||
self.selectComboEntry(self.form.cboOutputPolicy, PathPreferences.defaultOutputPolicy())
|
||||
|
||||
Reference in New Issue
Block a user