diff --git a/Cura/alterations/start.gcode b/Cura/alterations/start.gcode index 7db5699c..4f1222a5 100644 --- a/Cura/alterations/start.gcode +++ b/Cura/alterations/start.gcode @@ -4,6 +4,8 @@ G90 ;absolute positioning G28 X0 Y0 ;move X/Y to min endstops G28 Z0 ;move Z to min endstops +M106 ;turn on fan + ; if your prints start too high, try changing the Z0.0 below ; to Z1.0 - the number after the Z is the actual, physical ; height of the nozzle in mm. This can take some messing around diff --git a/Cura/cura.py b/Cura/cura.py index 4de0ed12..2d2d7e43 100644 --- a/Cura/cura.py +++ b/Cura/cura.py @@ -16,6 +16,7 @@ import sys import platform from optparse import OptionParser +from util import profile from util import sliceRun __author__ = 'Daid' @@ -43,9 +44,11 @@ Art of Illusion """ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' def main(): - parser = OptionParser() + parser = OptionParser(usage="usage: %prog [options] .stl") + parser.add_option("-p", "--profile", action="store", type="string", dest="profile", help="Use these profile settings instead of loading current_profile.ini") (options, args) = parser.parse_args() - sys.argv = [sys.argv[0]] + args + if options.profile != None: + profile.loadGlobalProfileFromString(options.profile) if len( args ) > 0: sliceRun.runSlice(args) else: diff --git a/Cura/cura_sf/fabmetheus_utilities/settings.py b/Cura/cura_sf/fabmetheus_utilities/settings.py index 3c27c0f4..f89fa870 100644 --- a/Cura/cura_sf/fabmetheus_utilities/settings.py +++ b/Cura/cura_sf/fabmetheus_utilities/settings.py @@ -103,7 +103,7 @@ def getProfileInformation(): 'Activate_Widen': DEFSET, 'Widen_Width_over_Edge_Width_ratio': DEFSET, },'inset': { - 'Add_Custom_Code_for_Temperature_Reading': DEFSET, + 'Add_Custom_Code_for_Temperature_Reading': "False", 'Infill_in_Direction_of_Bridge': "True", 'Infill_Width': storedSetting("nozzle_size"), 'Loop_Order_Choice': DEFSET, @@ -265,8 +265,8 @@ def getProfileInformation(): 'Name_of_Cool_End_File': DEFSET, 'Name_of_Cool_Start_File': DEFSET, 'Orbital_Outset_millimeters': DEFSET, - 'Turn_Fan_On_at_Beginning': DEFSET, - 'Turn_Fan_Off_at_Ending': DEFSET, + 'Turn_Fan_On_at_Beginning': "False", + 'Turn_Fan_Off_at_Ending': "False", 'Minimum_feed_rate_mm/s': storedSetting("cool_min_feedrate"), },'hop': { 'Activate_Hop': "False", diff --git a/Cura/gui/alterationPanel.py b/Cura/gui/alterationPanel.py index 425c823c..c47b7c8a 100644 --- a/Cura/gui/alterationPanel.py +++ b/Cura/gui/alterationPanel.py @@ -25,6 +25,7 @@ class alterationPanel(wx.Panel): self.SetSizer(sizer) self.loadFile(self.alterationFileList[self.list.GetSelection()]) + self.currentFile = self.list.GetSelection() def OnSelect(self, e): self.loadFile(self.alterationFileList[self.list.GetSelection()]) diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 2aefdc28..67377eac 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -265,8 +265,6 @@ class mainWindow(configBase.configWindowBase): def OnSlice(self, e): if self.filename == None: return - profile.saveGlobalProfile(profile.getDefaultProfilePath()) - #Create a progress panel and add it to the window. The progress panel will start the Skein operation. spp = sliceProgessPanel.sliceProgessPanel(self, self, self.filename) self.sizer.Add(spp, (len(self.progressPanelList)+2,0), span=(1,4), flag=wx.EXPAND) diff --git a/Cura/gui/simpleMode.py b/Cura/gui/simpleMode.py index 003a79d6..e2a6d91e 100644 --- a/Cura/gui/simpleMode.py +++ b/Cura/gui/simpleMode.py @@ -162,6 +162,9 @@ class simpleModeWindow(configBase.configWindowBase): def OnSlice(self, e): if self.filename == None: return + #save the current profile so we can put it back latter + oldProfile = profile.getGlobalProfileString() + put = profile.putProfileSetting get = profile.getProfileSetting @@ -220,6 +223,7 @@ class simpleModeWindow(configBase.configWindowBase): put('layer_height', '0.3') put('fill_density', '10') put('print_speed', '80') + put('bottom_layer_speed', '40') elif self.printTypeHigh.GetValue(): put('wall_thickness', nozzle_size * 3.0) put('layer_height', '0.1') @@ -240,11 +244,11 @@ class simpleModeWindow(configBase.configWindowBase): if self.printMaterialPLA.GetValue(): put('filament_density', '1.00') put('enable_raft', 'False') + put('skirt_line_count', '1') else: put('filament_density', '0.85') put('enable_raft', 'True') - - profile.saveGlobalProfile(profile.getDefaultProfilePath()) + put('skirt_line_count', '0') #Create a progress panel and add it to the window. The progress panel will start the Skein operation. spp = sliceProgessPanel.sliceProgessPanel(self, self, self.filename) @@ -254,6 +258,9 @@ class simpleModeWindow(configBase.configWindowBase): newSize.IncBy(0, spp.GetSize().GetHeight()) self.SetSize(newSize) self.progressPanelList.append(spp) + + #Restore the old profile. + profile.loadGlobalProfileFromString(oldProfile) def OnPrint(self, e): printWindow.printWindow() @@ -283,5 +290,4 @@ class simpleModeWindow(configBase.configWindowBase): self.Close() def OnClose(self, e): - profile.saveGlobalProfile(profile.getDefaultProfilePath()) self.Destroy() diff --git a/Cura/gui/sliceProgessPanel.py b/Cura/gui/sliceProgessPanel.py index 5854060e..bdf2e82e 100644 --- a/Cura/gui/sliceProgessPanel.py +++ b/Cura/gui/sliceProgessPanel.py @@ -57,7 +57,8 @@ class sliceProgessPanel(wx.Panel): self.prevStep = 'start' self.totalDoneFactor = 0.0 self.startTime = time.time() - self.thread = WorkerThread(self, filename) + p = subprocess.Popen(sliceRun.getSliceCommand(self.filename), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + self.thread = WorkerThread(self, filename, p) def OnAbort(self, e): if self.abort: @@ -108,14 +109,15 @@ class sliceProgessPanel(wx.Panel): self.statusText.SetLabel(stepName + " [" + str(layer) + "/" + str(maxLayer) + "]") class WorkerThread(threading.Thread): - def __init__(self, notifyWindow, filename): + def __init__(self, notifyWindow, filename, process): threading.Thread.__init__(self) self.filename = filename self.notifyWindow = notifyWindow + self.process = process self.start() def run(self): - p = subprocess.Popen(sliceRun.getSliceCommand(self.filename), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + p = self.process line = p.stdout.readline() maxValue = 1 self.progressLog = [] diff --git a/Cura/util/profile.py b/Cura/util/profile.py index daa82541..8ab00bd3 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -85,10 +85,23 @@ def saveGlobalProfile(filename): #Save the current profile to an ini file globalProfileParser.write(open(filename, 'w')) -def resetGlobalProfile(): - #Create an empty profile with no settings, so everything gets default settings. +def loadGlobalProfileFromString(options): global globalProfileParser globalProfileParser = ConfigParser.ConfigParser() + globalProfileParser.add_section('profile') + for option in options.split('#'): + (key, value) = option.split('=', 1) + globalProfileParser.set('profile', key, value) + +def getGlobalProfileString(): + global globalProfileParser + if not globals().has_key('globalProfileParser'): + loadGlobalProfile(getDefaultProfilePath()) + + ret = [] + for key in globalProfileParser.options('profile'): + ret.append(key + "=" + globalProfileParser.get('profile', key)) + return '#'.join(ret) def getProfileSetting(name): if name in profileDefaultSettings: diff --git a/Cura/util/sliceRun.py b/Cura/util/sliceRun.py index e18fb98a..4813f359 100644 --- a/Cura/util/sliceRun.py +++ b/Cura/util/sliceRun.py @@ -58,7 +58,7 @@ def runSlice(fileNames): print "* Failed to find pypy, so sliced with python! *" print "************************************************" else: - subprocess.call([pypyExe, os.path.join(sys.path[0], sys.argv[0]), fileName]) + subprocess.call([pypyExe, os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", os.path.split(sys.argv[0])[1])), '-p', profile.getGlobalProfileString(), fileName]) def getSliceCommand(filename): if profile.getPreference('slicer').startswith('Slic3r'): @@ -116,5 +116,5 @@ def getSliceCommand(filename): pypyExe = getPyPyExe() if pypyExe == False: pypyExe = sys.executable - return [pypyExe, os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", os.path.split(sys.argv[0])[1])), filename] + return [pypyExe, os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", os.path.split(sys.argv[0])[1])), '-p', profile.getGlobalProfileString(), filename]