diff --git a/Cura/cura_sf/fabmetheus_utilities/settings.py b/Cura/cura_sf/fabmetheus_utilities/settings.py index b7aeaa1..9734ba8 100644 --- a/Cura/cura_sf/fabmetheus_utilities/settings.py +++ b/Cura/cura_sf/fabmetheus_utilities/settings.py @@ -25,6 +25,8 @@ def storedSettingInt(name): return lambda setting: int(profile.getProfileSettingFloat(name)) def storedPreference(name): return lambda setting: profile.getPreference(name) +def storedPreferenceFloat(name): + return lambda setting: profile.getPreferenceFloat(name) def storedSettingInvertBoolean(name): return lambda setting: profile.getProfileSetting(name) == "False" @@ -240,6 +242,8 @@ def getProfileInformation(): 'Support_Material_Choice_': storedSetting('support'), 'Support_Minimum_Angle_degrees': DEFSET, 'Support_Margin_mm': '3.0', + 'Support_Offset_X_mm': lambda setting: -profile.getPreferenceFloat('extruder_offset_x1') if profile.getProfileSetting('support_dual_extrusion') == 'True' and int(profile.getPreference('extruder_amount')) > 1 else '0', + 'Support_Offset_Y_mm': lambda setting: -profile.getPreferenceFloat('extruder_offset_y1') if profile.getProfileSetting('support_dual_extrusion') == 'True' and int(profile.getPreference('extruder_amount')) > 1 else '0', },'skirt': { 'Skirt_line_count': storedSetting("skirt_line_count"), 'Convex': "True", diff --git a/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py b/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py index 230a5f3..c364cf9 100644 --- a/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py +++ b/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py @@ -402,6 +402,8 @@ class RaftRepository: self.executeTitle = 'Raft' self.supportMargin = settings.FloatSpin().getFromValue( 1.0, 'Support Margin (mm):', self, 5.0, 3.0) + self.supportOffsetX = settings.FloatSpin().getFromValue(0.0, 'Support Offset X (mm):', self, 100.0, 0.0) + self.supportOffsetY = settings.FloatSpin().getFromValue(0.0, 'Support Offset Y (mm):', self, 100.0, 0.0) def execute(self): 'Raft button has been clicked.' @@ -698,8 +700,8 @@ class RaftSkein: def addSupportLayerTemperature(self, endpoints, z): 'Add support layer and temperature before the object layer.' - self.distanceFeedRate.addLine('()') self.distanceFeedRate.addLinesSetAbsoluteDistanceMode(self.supportStartLines) + self.distanceFeedRate.addLine('()') self.addTemperatureOrbits(endpoints, self.supportedLayersTemperature, z) aroundPixelTable = {} aroundWidth = 0.34321 * self.interfaceStep @@ -717,6 +719,7 @@ class RaftSkein: supportFlowRateMultiplied = self.operatingFlowRate * self.objectFirstLayerFlowRateInfillMultiplier self.addFlowRate(supportFlowRateMultiplied) for path in paths: + path = map(lambda p: p + complex(self.supportOffsetX, self.supportOffsetY), path) self.distanceFeedRate.addGcodeFromFeedRateThreadZ(feedRateMinuteMultiplied, path, self.travelFeedRateMinute, z) self.addFlowRate(self.oldFlowRate) self.addTemperatureOrbits(endpoints, self.supportLayersTemperature, z) @@ -815,6 +818,8 @@ class RaftSkein: self.minimumSupportRatio = math.tan( math.radians( repository.supportMinimumAngle.value ) ) self.supportEndLines = settings.getAlterationFileLines(repository.nameOfSupportEndFile.value) self.supportStartLines = settings.getAlterationFileLines(repository.nameOfSupportStartFile.value) + self.supportOffsetX = repository.supportOffsetX.value + self.supportOffsetY = repository.supportOffsetY.value self.lines = archive.getTextLines(gcodeText) self.parseInitialization() self.temperatureChangeTimeBeforeRaft = 0.0 diff --git a/Cura/gui/alterationPanel.py b/Cura/gui/alterationPanel.py index da227b2..6c532ee 100644 --- a/Cura/gui/alterationPanel.py +++ b/Cura/gui/alterationPanel.py @@ -8,7 +8,7 @@ class alterationPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent,-1) - self.alterationFileList = ['start.gcode', 'end.gcode', 'support_start.gcode', 'support_end.gcode', 'nextobject.gcode', 'replace.csv'] + self.alterationFileList = ['start.gcode', 'end.gcode', 'nextobject.gcode', 'replace.csv'] if int(profile.getPreference('extruder_amount')) > 1: self.alterationFileList.append('switchExtruder.gcode') self.currentFile = None diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 85110cf..f20b01b 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -38,6 +38,8 @@ class mainWindow(configBase.configWindowBase): "Main user interface window" def __init__(self): super(mainWindow, self).__init__(title='Cura - ' + version.getVersion()) + + extruderCount = int(profile.getPreference('extruder_amount')) wx.EVT_CLOSE(self, self.OnClose) #self.SetIcon(icon.getMainIcon()) @@ -151,6 +153,8 @@ class mainWindow(configBase.configWindowBase): configBase.TitleRow(right, "Support") c = configBase.SettingRow(right, "Support type", 'support', ['None', 'Exterior Only', 'Everywhere', 'Empty Layers Only'], 'Type of support structure build.\n"Exterior only" is the most commonly used support setting.\n\nNone does not do any support.\nExterior only only creates support on the outside.\nEverywhere creates support even on the insides of the model.\nOnly on empty layers is for stacked objects.') c = configBase.SettingRow(right, "Add raft", 'enable_raft', False, 'A raft is a few layers of lines below the bottom of the object. It prevents warping. Full raft settings can be found in the expert settings.\nFor PLA this is usually not required. But if you print with ABS it is almost required.') + if extruderCount > 1: + c = configBase.SettingRow(right, "Support dual extrusion", 'support_dual_extrusion', False, 'Print the support material with the 2nd extruder in a dual extrusion setup. The primary extruder will be used for normal material, while the second extruder is used to print support material.') configBase.TitleRow(right, "Filament") c = configBase.SettingRow(right, "Diameter (mm)", 'filament_diameter', '2.89', 'Diameter of your filament, as accurately as possible.\nIf you cannot measure this value you will have to callibrate it, a higher number means less extrusion, a smaller number generates more extrusion.') @@ -212,7 +216,6 @@ class mainWindow(configBase.configWindowBase): self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton) self.Bind(wx.EVT_BUTTON, self.OnPrint, printButton) - extruderCount = int(profile.getPreference('extruder_amount')) if extruderCount > 1: loadButton2 = wx.Button(self, -1, 'Load Dual') self.Bind(wx.EVT_BUTTON, lambda e: self._showModelLoadDialog(2), loadButton2) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 468fd99..7d91cf4 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -60,6 +60,7 @@ profileDefaultSettings = { 'fill_overlap': '15', 'support_rate': '50', 'support_distance': '0.5', + 'support_dual_extrusion': 'False', 'joris': 'False', 'enable_skin': 'False', 'enable_raft': 'False', @@ -365,6 +366,8 @@ def isPreference(name): tempOverride = {} def setTempOverride(name, value): tempOverride[name] = unicode(value).encode("utf-8") +def clearTempOverride(name): + del tempOverride[name] def resetTempOverride(): tempOverride.clear() @@ -500,13 +503,22 @@ def getAlterationFileContents(filename): prefix += 'M109 S%f\n' % (temp) if bedTemp > 0 and not '{print_bed_temperature}' in alterationContents: prefix += 'M190 S%f\n' % (bedTemp) - elif filename == 'end.gcode': #Append the profile string to the end of the GCode, so we can load it from the GCode file later. postfix = ';CURA_PROFILE_STRING:%s\n' % (getGlobalProfileString()) elif filename == 'replace.csv': #Always remove the extruder on/off M codes. These are no longer needed in 5D printing. prefix = 'M101\nM103\n' - + elif filename == 'support_start.gcode' or filename == 'support_end.gcode': + #Add support start/end code + if getProfileSetting('support_dual_extrusion') == 'True' and int(getPreference('extruder_amount')) > 1: + if filename == 'support_start.gcode': + setTempOverride('extruder', '1') + else: + setTempOverride('extruder', '0') + alterationContents = getAlterationFileContents('switchExtruder.gcode') + clearTempOverride('extruder') + else: + alterationContents = '' return unicode(prefix + re.sub("(.)\{([^\}]*)\}", replaceTagMatch, alterationContents).rstrip() + '\n' + postfix).encode('utf-8')