def addRaft(self):
'Add the raft.'
- if len(self.boundaryLayers) < 1:
- print('this should never happen, there are no boundary layers in addRaft')
- return
self.baseLayerThicknessOverLayerThickness = self.repository.baseLayerThicknessOverLayerThickness.value
baseExtrusionWidth = self.edgeWidth * self.baseLayerThicknessOverLayerThickness
self.baseStep = baseExtrusionWidth / self.repository.baseInfillDensity.value
self.raftOutsetRadius = self.repository.raftMargin.value + self.repository.raftAdditionalMarginOverLengthPercent.value * 0.01 * max(originalExtent.real, originalExtent.imag)
self.supportOutsetRadius = self.repository.supportMargin.value
self.setBoundaryLayers()
+ if len(self.boundaryLayers) < 1:
+ print('this should never happen, there are no boundary layers in addRaft')
+ return
outsetSeparateLoops = intercircle.getInsetSeparateLoopsFromLoops(self.boundaryLayers[0].loops, -self.raftOutsetRadius, 0.8)
self.interfaceIntersectionsTable = {}
euclidean.addXIntersectionsFromLoopsForTable(outsetSeparateLoops, self.interfaceIntersectionsTable, self.interfaceStep)
if len(endpoints) < 1:
temperatureChangeTimeBeforeNextLayers = self.getTemperatureChangeTime( self.objectNextLayersTemperature )
self.addTemperatureLineIfDifferent( self.objectNextLayersTemperature )
- if self.repository.addRaftElevateNozzleOrbitSetAltitude.value and len( boundaryLayer.loops ) > 0:
+ if self.repository.addRaftElevateNozzleOrbitSetAltitude.value and boundaryLayer != None and len( boundaryLayer.loops ) > 0:
self.addOperatingOrbits( boundaryLayer.loops, euclidean.getXYComplexFromVector3( self.oldLocation ), temperatureChangeTimeBeforeNextLayers, layerZ )
if len(endpoints) > 0:
self.addSupportLayerTemperature( endpoints, layerZ )
self.centerX = -self.getMinimum().x + 5\r
self.centerY = -self.getMinimum().y + 5\r
\r
+ def isSameExceptForPosition(self, other):\r
+ if self.filename != other.filename:\r
+ return False\r
+ if self.scale != other.scale:\r
+ return False\r
+ if self.rotate != other.rotate:\r
+ return False\r
+ if self.flipX != other.flipX:\r
+ return False\r
+ if self.flipY != other.flipY:\r
+ return False\r
+ if self.flipZ != other.flipZ:\r
+ return False\r
+ if self.swapXZ != other.swapXZ:\r
+ return False\r
+ if self.swapYZ != other.swapYZ:\r
+ return False\r
+ if self.extruder != other.extruder:\r
+ return False\r
+ if self.profile != other.profile:\r
+ return False\r
+ return True\r
+\r
def updateModelTransform(self):\r
rotate = self.rotate / 180.0 * math.pi\r
scaleX = 1.0\r
action.filename = item.filename\r
clearZ = max(clearZ, item.getMaximum().z * item.scale)\r
action.clearZ = clearZ\r
+ action.leaveForNext = False\r
+ action.usePrevious = False\r
actionList.append(action)\r
\r
+ if self.list.index(item) > 0 and item.isSameExceptForPosition(self.list[self.list.index(item)-1]):\r
+ actionList[-2].leaveForNext = True\r
+ actionList[-1].usePrevious = True\r
+\r
if item.profile != None:\r
profile.loadGlobalProfileFromString(oldProfile)\r
\r
put = profile.setTempOverride\r
for action in self.actionList:\r
wx.CallAfter(self.SetTitle, "Building: [%d/%d]" % (self.actionList.index(action) + 1, len(self.actionList)))\r
- p = subprocess.Popen(action.sliceCmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\r
- line = p.stdout.readline()\r
- \r
- maxValue = 1\r
- self.progressLog = []\r
- while(len(line) > 0):\r
- line = line.rstrip()\r
- if line[0:9] == "Progress[" and line[-1:] == "]":\r
- progress = line[9:-1].split(":")\r
- if len(progress) > 2:\r
- maxValue = int(progress[2])\r
- wx.CallAfter(self.SetProgress, progress[0], int(progress[1]), maxValue)\r
- else:\r
- print line\r
- self.progressLog.append(line)\r
- wx.CallAfter(self.statusText.SetLabel, line)\r
- if self.abort:\r
- p.terminate()\r
- wx.CallAfter(self.statusText.SetLabel, "Aborted by user.")\r
- resultFile.close()\r
- return\r
+ if not action.usePrevious:\r
+ p = subprocess.Popen(action.sliceCmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\r
line = p.stdout.readline()\r
- self.returnCode = p.wait()\r
+ \r
+ maxValue = 1\r
+ self.progressLog = []\r
+ while(len(line) > 0):\r
+ line = line.rstrip()\r
+ if line[0:9] == "Progress[" and line[-1:] == "]":\r
+ progress = line[9:-1].split(":")\r
+ if len(progress) > 2:\r
+ maxValue = int(progress[2])\r
+ wx.CallAfter(self.SetProgress, progress[0], int(progress[1]), maxValue)\r
+ else:\r
+ print line\r
+ self.progressLog.append(line)\r
+ wx.CallAfter(self.statusText.SetLabel, line)\r
+ if self.abort:\r
+ p.terminate()\r
+ wx.CallAfter(self.statusText.SetLabel, "Aborted by user.")\r
+ resultFile.close()\r
+ return\r
+ line = p.stdout.readline()\r
+ self.returnCode = p.wait()\r
\r
put('machine_center_x', action.centerX - self.extruderOffset[action.extruder].x)\r
put('machine_center_y', action.centerY - self.extruderOffset[action.extruder].y)\r
resultFile.write(';PRINTNR:%d\n' % self.actionList.index(action))\r
profile.resetTempOverride()\r
\r
- f = open(action.filename[: action.filename.rfind('.')] + "_export.project_tmp", "r")\r
- data = f.read(4096)\r
- while data != '':\r
- resultFile.write(data)\r
+ if not action.usePrevious:\r
+ f = open(action.filename[: action.filename.rfind('.')] + "_export.project_tmp", "r")\r
data = f.read(4096)\r
- f.close()\r
- os.remove(action.filename[: action.filename.rfind('.')] + "_export.project_tmp")\r
+ while data != '':\r
+ resultFile.write(data)\r
+ data = f.read(4096)\r
+ f.close()\r
+ else:\r
+ f = open(action.filename[: action.filename.rfind('.')] + "_export.project_tmp", "r")\r
+ for line in f:\r
+ resultFile.write(line)\r
+ f.close()\r
+\r
+ if not action.leaveForNext:\r
+ os.remove(action.filename[: action.filename.rfind('.')] + "_export.project_tmp")\r
\r
wx.CallAfter(self.progressGauge.SetValue, 10000)\r
self.totalDoneFactor = 0.0\r