chiark / gitweb /
Fixed bug when wall width was less then the nozzle size.
authordaid <daid303@gmail.com>
Mon, 27 Feb 2012 15:40:33 +0000 (16:40 +0100)
committerdaid <daid303@gmail.com>
Mon, 27 Feb 2012 15:40:33 +0000 (16:40 +0100)
Added advanced settings (mostly for 'joris' cups)

SkeinPyPy_NewUI/fabmetheus_utilities/settings.py
SkeinPyPy_NewUI/newui/advancedConfig.py [new file with mode: 0644]
SkeinPyPy_NewUI/newui/configWindowBase.py
SkeinPyPy_NewUI/newui/mainWindow.py
SkeinPyPy_NewUI/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py

index 38de64770b38beaadfe8a698fdf964666b4ba6d0..bd4c89b4dcb6738f6c26e71bbb42c4a250fbda6c 100644 (file)
@@ -22,6 +22,9 @@ def storedSetting(name):
 def ifSettingAboveZero(name):
        return lambda setting: float(getSetting(name, '0.0')) > 0
 
+def ifSettingIs(name, value):
+       return lambda setting: getSetting(name) == value
+
 def storedPercentSetting(name):
        return lambda setting: float(getSetting(name, setting.value)) / 100
 
@@ -40,11 +43,16 @@ def calculateEdgeWidth(setting):
        return lineWidth
 
 def calculateShells(setting):
-       wallThickness = float(getSetting('wall_thickness'))
+       return calculateShellsImp(float(getSetting('wall_thickness')))
+
+def calculateShellsBase(setting):
+       return calculateShellsImp(float(getSetting('wall_thickness')) + float(getSetting('extra_base_wall_thickness')))
+
+def calculateShellsImp(wallThickness):
        nozzleSize = float(getSetting('nozzle_size'))
        
        if wallThickness < nozzleSize:
-               return wallThickness
+               return 0
 
        lineCount = int(wallThickness / nozzleSize + 0.0001)
        lineWidth = wallThickness / lineCount
@@ -106,10 +114,12 @@ def getSkeinPyPyProfileInformation():
                        'Volume_Fraction_ratio': DEFSET,
                },'fill': {
                        'Activate_Fill': "True",
+                       'Solid_Surface_Top': storedSetting("solid_top"),
+                       'Override_First_Layer_Sequence': storedSetting("force_first_layer_sequence"),
                        'Diaphragm_Period_layers': DEFSET,
                        'Diaphragm_Thickness_layers': DEFSET,
                        'Extra_Shells_on_Alternating_Solid_Layer_layers': calculateShells,
-                       'Extra_Shells_on_Base_layers': calculateShells,
+                       'Extra_Shells_on_Base_layers': calculateShellsBase,
                        'Extra_Shells_on_Sparse_Layer_layers': calculateShells,
                        'Grid_Circle_Separation_over_Perimeter_Width_ratio': DEFSET,
                        'Grid_Extra_Overlap_ratio': DEFSET,
@@ -119,10 +129,10 @@ def getSkeinPyPyProfileInformation():
                        'Infill_Begin_Rotation_degrees': DEFSET,
                        'Infill_Begin_Rotation_Repeat_layers': DEFSET,
                        'Infill_Odd_Layer_Extra_Rotation_degrees': DEFSET,
-                       'Grid_Circular': DEFSET,
-                       'Grid_Hexagonal': DEFSET,
-                       'Grid_Rectangular': DEFSET,
-                       'Line': DEFSET,
+                       'Grid_Circular': ifSettingIs('infill_type', 'Grid Circular'),
+                       'Grid_Hexagonal': ifSettingIs('infill_type', 'Grid Hexagonal'),
+                       'Grid_Rectangular': ifSettingIs('infill_type', 'Grid Rectangular'),
+                       'Line': ifSettingIs('infill_type', 'Line'),
                        'Infill_Perimeter_Overlap_ratio': DEFSET,
                        'Infill_Solidity_ratio': storedPercentSetting('fill_density'),
                        'Infill_Width': storedSetting("nozzle_size"),
diff --git a/SkeinPyPy_NewUI/newui/advancedConfig.py b/SkeinPyPy_NewUI/newui/advancedConfig.py
new file mode 100644 (file)
index 0000000..6bdfe8d
--- /dev/null
@@ -0,0 +1,34 @@
+from __future__ import absolute_import
+import __init__
+
+import wx, os, platform, types
+import ConfigParser
+
+from fabmetheus_utilities import settings
+
+from newui import configWindowBase
+from newui import preview3d
+from newui import sliceProgessPanel
+from newui import alterationPanel
+from newui import validators
+
+class advancedConfigWindow(configWindowBase.configWindowBase):
+       "Advanced configuration window"
+       def __init__(self):
+               super(advancedConfigWindow, self).__init__(title='Advanced config')
+
+               left, right, main = self.CreateConfigPanel(self)
+               
+               configWindowBase.TitleRow(left, "Accuracy")
+               c = configWindowBase.SettingRow(left, "Extra Wall thickness for bottom/top (mm)", 'extra_base_wall_thickness', '0.0', 'Additional perimeter thickness of the bottom layer.')
+               validators.validFloat(c, 0.0)
+               validators.wallThicknessValidator(c)
+
+               configWindowBase.TitleRow(left, "Infill")
+               c = configWindowBase.SettingRow(left, "Infill pattern", 'infill_type', ['Line', 'Grid Circular', 'Grid Hexagonal', 'Grid Rectangular'], 'Pattern of the none-solid infill. Line is default, but grids can provide a strong print.')
+               c = configWindowBase.SettingRow(left, "Solid infill top", 'solid_top', ['True', 'False'], 'Create a solid top surface, if set to false the top is filled with the fill percentage. Useful for cups.')
+               c = configWindowBase.SettingRow(left, "Force first layer sequence", 'force_first_layer_sequence', ['True', 'False'], 'This setting forces the order of the first layer to be \'Perimeter > Loops > Infill\'')
+
+               main.Fit()
+               self.Fit()
+
index 81da88f4e7af231c937634e6a5a529a00ab9d326..730cb7333099baa4b05fddeb04e4ea9e80128cc5 100644 (file)
@@ -132,7 +132,6 @@ class SettingRow():
                        elif res == validators.WARNING and result != validators.ERROR:
                                result = res
                        if res != validators.SUCCESS:
-                               print err
                                msgs.append(err)
                if result == validators.ERROR:
                        self.ctrl.SetBackgroundColour('Red')
index 483d257196c659c20971edf931ef7a508d37415f..4e6231e7061b67a36e6baa9152f767b39cee68b3 100644 (file)
@@ -7,6 +7,7 @@ import ConfigParser
 from fabmetheus_utilities import settings
 
 from newui import configWindowBase
+from newui import advancedConfig
 from newui import preview3d
 from newui import sliceProgessPanel
 from newui import alterationPanel
@@ -155,7 +156,7 @@ class mainWindow(configWindowBase.configWindowBase):
                if self.filename != None:
                        self.preview3d.loadModelFile(self.filename)
                        self.lastPath = os.path.split(self.filename)[0]
-               
+
                self.updateProfileToControls()
 
                self.Fit()
@@ -186,7 +187,7 @@ class mainWindow(configWindowBase.configWindowBase):
                dlg.SetWildcard("OBJ, STL files (*.stl;*.obj)|*.stl;*.obj")
                if dlg.ShowModal() == wx.ID_OK:
                        self.filename=dlg.GetPath()
-                       putPreference('lastFile', self.filename)
+                       configWindowBase.putPreference('lastFile', self.filename)
                        if not(os.path.exists(self.filename)):
                                return
                        self.lastPath = os.path.split(self.filename)[0]
@@ -208,7 +209,9 @@ class mainWindow(configWindowBase.configWindowBase):
                self.progressPanelList.append(spp)
 
        def OnExpertOpen(self, e):
-               pass
+               acw = advancedConfig.advancedConfigWindow()
+               acw.Centre()
+               acw.Show(True)
 
        def removeSliceProgress(self, spp):
                self.progressPanelList.remove(spp)
index 75ea0f2058853180b9fde1ea57b6d5587c05cd8d..7cf5bcce346aeb099deb69b9f09d2ae0eeca5d7e 100644 (file)
@@ -769,6 +769,8 @@ class FillRepository:
                self.fileNameInput = settings.FileNameInput().getFromFileName( fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Fill', self, '')
                self.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Fill')
                self.activateFill = settings.BooleanSetting().getFromValue('Activate Fill', self, True)
+               self.solidSurfaceTop = settings.BooleanSetting().getFromValue('Solid Surface Top', self, True)
+               self.overrideFirstLayerSequence = settings.BooleanSetting().getFromValue('Override First Layer Sequence', self, True)
                settings.LabelSeparator().getFromRepository(self)
                settings.LabelDisplay().getFromName('- Diaphragm -', self )
                self.diaphragmPeriod = settings.IntSpin().getFromValue( 20, 'Diaphragm Period (layers):', self, 200, 100 )
@@ -862,8 +864,12 @@ class FillSkein:
                self.distanceFeedRate.addLine('(<layer> %s )' % rotatedLayer.z)
                if layerRemainder >= int(round(self.repository.diaphragmThickness.value)):
                        for surroundingIndex in xrange(1, self.solidSurfaceThickness + 1):
-                               self.addRotatedCarve(layerIndex, -surroundingIndex, reverseRotation, surroundingCarves)
-                               self.addRotatedCarve(layerIndex, surroundingIndex, reverseRotation, surroundingCarves)
+                               if self.repository.solidSurfaceTop.value:
+                                       self.addRotatedCarve(layerIndex, -surroundingIndex, reverseRotation, surroundingCarves)
+                                       self.addRotatedCarve(layerIndex, surroundingIndex, reverseRotation, surroundingCarves)
+                               else:
+                                       self.addRotatedCarve(layerIndex, -surroundingIndex, reverseRotation, surroundingCarves)
+                                       self.addRotatedCarve(layerIndex, -surroundingIndex, reverseRotation, surroundingCarves)
                if len(surroundingCarves) < self.doubleSolidSurfaceThickness:
                        extraShells = self.repository.extraShellsAlternatingSolidLayer.value
                        if self.lastExtraShells != self.repository.extraShellsBase.value:
@@ -1085,7 +1091,7 @@ class FillSkein:
                        self.oldOrderedLocation = getLowerLeftCorner(nestedRings)
                extrusionHalfWidth = 0.5 * self.infillWidth
                threadSequence = self.threadSequence
-               if layerIndex < 1:
+               if layerIndex < 1 and self.repository.overrideFirstLayerSequence.value:
                        threadSequence = ['edge', 'loops', 'infill']
                euclidean.addToThreadsRemove(extrusionHalfWidth, nestedRings, self.oldOrderedLocation, self, threadSequence)
                if testLoops != None: