Better sanity checks in raft plugin.

This commit is contained in:
daid 2012-05-16 12:41:16 +02:00
parent de60050130
commit 415ef2eaa6
2 changed files with 70 additions and 32 deletions

View File

@ -585,9 +585,6 @@ class RaftSkein:
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
@ -600,6 +597,9 @@ class RaftSkein:
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)
@ -990,7 +990,7 @@ class RaftSkein:
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 )

View File

@ -66,6 +66,29 @@ class ProjectObject(stl.stlModel):
self.centerX = -self.getMinimum().x + 5
self.centerY = -self.getMinimum().y + 5
def isSameExceptForPosition(self, other):
if self.filename != other.filename:
return False
if self.scale != other.scale:
return False
if self.rotate != other.rotate:
return False
if self.flipX != other.flipX:
return False
if self.flipY != other.flipY:
return False
if self.flipZ != other.flipZ:
return False
if self.swapXZ != other.swapXZ:
return False
if self.swapYZ != other.swapYZ:
return False
if self.extruder != other.extruder:
return False
if self.profile != other.profile:
return False
return True
def updateModelTransform(self):
rotate = self.rotate / 180.0 * math.pi
scaleX = 1.0
@ -545,8 +568,14 @@ class projectPlanner(wx.Frame):
action.filename = item.filename
clearZ = max(clearZ, item.getMaximum().z * item.scale)
action.clearZ = clearZ
action.leaveForNext = False
action.usePrevious = False
actionList.append(action)
if self.list.index(item) > 0 and item.isSameExceptForPosition(self.list[self.list.index(item)-1]):
actionList[-2].leaveForNext = True
actionList[-1].usePrevious = True
if item.profile != None:
profile.loadGlobalProfileFromString(oldProfile)
@ -842,6 +871,7 @@ class ProjectSliceProgressWindow(wx.Frame):
put = profile.setTempOverride
for action in self.actionList:
wx.CallAfter(self.SetTitle, "Building: [%d/%d]" % (self.actionList.index(action) + 1, len(self.actionList)))
if not action.usePrevious:
p = subprocess.Popen(action.sliceCmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
line = p.stdout.readline()
@ -883,12 +913,20 @@ class ProjectSliceProgressWindow(wx.Frame):
resultFile.write(';PRINTNR:%d\n' % self.actionList.index(action))
profile.resetTempOverride()
if not action.usePrevious:
f = open(action.filename[: action.filename.rfind('.')] + "_export.project_tmp", "r")
data = f.read(4096)
while data != '':
resultFile.write(data)
data = f.read(4096)
f.close()
else:
f = open(action.filename[: action.filename.rfind('.')] + "_export.project_tmp", "r")
for line in f:
resultFile.write(line)
f.close()
if not action.leaveForNext:
os.remove(action.filename[: action.filename.rfind('.')] + "_export.project_tmp")
wx.CallAfter(self.progressGauge.SetValue, 10000)