return '%0.2f meter %0.0f gram' % (float(self._filamentMM[e]) / 1000.0, self.getFilamentWeight(e) * 1000.0)
def runSlicer(self, scene):
+ if len(scene.objects()) < 1:
+ return
extruderCount = 1
for obj in scene.objects():
if scene.checkPlatform(obj):
extruderCount = max(extruderCount, len(obj._meshList))
- if profile.getProfileSetting('support_dual_extrusion') == 'Second extruder':
- extruderCount = max(extruderCount, 2)
+
+ extruderCount = max(extruderCount, profile.minimalExtruderCount())
commandList = [getEngineFilename(), '-vv']
for k, v in self._engineSettings(extruderCount).iteritems():
order = scene.printOrder()
if order is None:
pos = numpy.array(profile.getMachineCenterCoords()) * 1000
- commandList += ['-s', 'posx=%d' % int(pos[0]), '-s', 'posy=%d' % int(pos[1])]
-
- vertexTotal = 0
+ objMin = None
+ objMax = None
for obj in scene.objects():
if scene.checkPlatform(obj):
- for mesh in obj._meshList:
- vertexTotal += mesh.vertexCount
+ oMin = obj.getMinimum()[0:2] + obj.getPosition()
+ oMax = obj.getMaximum()[0:2] + obj.getPosition()
+ if objMin is None:
+ objMin = oMin
+ objMax = oMax
+ else:
+ objMin[0] = min(oMin[0], objMin[0])
+ objMin[1] = min(oMin[1], objMin[1])
+ objMax[0] = max(oMax[0], objMax[0])
+ objMax[1] = max(oMax[1], objMax[1])
+ pos += (objMin + objMax) / 2.0 * 1000
+ commandList += ['-s', 'posx=%d' % int(pos[0]), '-s', 'posy=%d' % int(pos[1])]
- f.write(numpy.array([vertexTotal], numpy.int32).tostring())
+ vertexTotal = [0] * 4
+ meshMax = 1
for obj in scene.objects():
if scene.checkPlatform(obj):
- for mesh in obj._meshList:
- vertexes = (numpy.matrix(mesh.vertexes, copy = False) * numpy.matrix(obj._matrix, numpy.float32)).getA()
- vertexes -= obj._drawOffset
- vertexes += numpy.array([obj.getPosition()[0], obj.getPosition()[1], 0.0])
- f.write(vertexes.tostring())
- hash.update(mesh.vertexes.tostring())
+ meshMax = max(meshMax, len(obj._meshList))
+ for n in xrange(0, len(obj._meshList)):
+ vertexTotal[n] += obj._meshList[n].vertexCount
+
+ for n in xrange(0, meshMax):
+ f.write(numpy.array([vertexTotal[n]], numpy.int32).tostring())
+ for obj in scene.objects():
+ if scene.checkPlatform(obj):
+ if n < len(obj._meshList):
+ vertexes = (numpy.matrix(obj._meshList[n].vertexes, copy = False) * numpy.matrix(obj._matrix, numpy.float32)).getA()
+ vertexes -= obj._drawOffset
+ vertexes += numpy.array([obj.getPosition()[0], obj.getPosition()[1], 0.0])
+ f.write(vertexes.tostring())
+ hash.update(obj._meshList[n].vertexes.tostring())
- commandList += ['#']
+ commandList += ['#' * meshMax]
self._objCount = 1
else:
for n in order:
'moveSpeed': int(profile.getProfileSettingFloat('travel_speed')),
'fanSpeedMin': int(profile.getProfileSettingFloat('fan_speed')) if profile.getProfileSetting('fan_enabled') == 'True' else 0,
'fanSpeedMax': int(profile.getProfileSettingFloat('fan_speed_max')) if profile.getProfileSetting('fan_enabled') == 'True' else 0,
- 'supportAngle': int(-1) if profile.getProfileSetting('support') == 'None' else int(60),
+ 'supportAngle': int(-1) if profile.getProfileSetting('support') == 'None' else int(profile.getProfileSettingFloat('support_angle')),
'supportEverywhere': int(1) if profile.getProfileSetting('support') == 'Everywhere' else int(0),
'supportLineDistance': int(100 * profile.calculateEdgeWidth() * 1000 / profile.getProfileSettingFloat('support_fill_rate')) if profile.getProfileSettingFloat('support_fill_rate') > 0 else -1,
'supportXYDistance': int(1000 * profile.getProfileSettingFloat('support_xy_distance')),
'supportZDistance': int(1000 * profile.getProfileSettingFloat('support_z_distance')),
- 'supportExtruder': 0 if profile.getProfileSetting('support_dual_extrusion') == 'First extruder' else (1 if profile.getProfileSetting('support_dual_extrusion') == 'Second extruder' else -1),
+ 'supportExtruder': 0 if profile.getProfileSetting('support_dual_extrusion') == 'First extruder' else (1 if profile.getProfileSetting('support_dual_extrusion') == 'Second extruder' and profile.minimalExtruderCount() > 1 else -1),
'retractionAmount': int(profile.getProfileSettingFloat('retraction_amount') * 1000) if profile.getProfileSetting('retraction_enable') == 'True' else 0,
'retractionSpeed': int(profile.getProfileSettingFloat('retraction_speed')),
'retractionMinimalDistance': int(profile.getProfileSettingFloat('retraction_min_travel') * 1000),
settings['gcodeFlavor'] = 1
if profile.getProfileSetting('spiralize') == 'True':
settings['spiralizeMode'] = 1
+ if profile.getProfileSetting('wipe_tower') == 'True':
+ settings['wipeTowerSize'] = int(math.sqrt(profile.getProfileSettingFloat('wipe_tower_volume') * 1000 * 1000 * 1000 / settings['layerThickness']))
+ if profile.getProfileSetting('ooze_shield') == 'True':
+ settings['enableOozeShield'] = 1
return settings
def _runSliceProcess(self, cmdList):