From: nallath Date: Thu, 6 Feb 2014 13:39:18 +0000 (+0100) Subject: Merge branch 'SteamEngine' of https://github.com/daid/Cura into SteamEngine X-Git-Tag: 14.02-RC1~30 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=976ecd9100e93cd3d42a45da434b087b1afdab6e;p=cura.git Merge branch 'SteamEngine' of https://github.com/daid/Cura into SteamEngine --- 976ecd9100e93cd3d42a45da434b087b1afdab6e diff --cc Cura/gui/util/engineResultView.py index 599ae4c3,67ceb53d..02a5cf3b --- a/Cura/gui/util/engineResultView.py +++ b/Cura/gui/util/engineResultView.py @@@ -284,4 -284,208 +284,4 @@@ class engineResultView(object) self.layerSelect.setValue(self.layerSelect.getValue() - 10) self._parent.QueueRefresh() return True - return False + return False - - # if self.viewMode == 'gcode' and self._gcode is not None: - # try: - # self._viewTarget[2] = self._gcode.layerList[self.layerSelect.getValue()][-1]['points'][0][2] - # except: - # pass - - # def _loadGCode(self): - # self._gcode.progressCallback = self._gcodeLoadCallback - # if self._gcodeFilename is not None: - # self._gcode.load(self._gcodeFilename) - # else: - # self._gcode.load(self._gcodeData) - # - # def _gcodeLoadCallback(self, progress): - # if not self or self._gcode is None: - # return True - # if len(self._gcode.layerList) % 15 == 0: - # time.sleep(0.1) - # if self._gcode is None: - # return True - # self.layerSelect.setRange(1, len(self._gcode.layerList) - 1) - # if self.viewMode == 'gcode': - # self._queueRefresh() - # return False - - # if self._gcodeLoadThread is not None and self._gcodeLoadThread.isAlive(): - # glDisable(GL_DEPTH_TEST) - # glPushMatrix() - # glLoadIdentity() - # glTranslate(0,-4,-10) - # glColor4ub(60,60,60,255) - # opengl.glDrawStringCenter(_("Loading toolpath for visualization...")) - # glPopMatrix() - - -# if self._gcode is not None: -# self._gcode = None -# for layerVBOlist in self._gcodeVBOs: -# for vbo in layerVBOlist: -# self.glReleaseList.append(vbo) -# self._gcodeVBOs = [] - - # if self._gcode is not None and self._gcode.layerList is None: - # self._gcodeLoadThread = threading.Thread(target=self._loadGCode) - # self._gcodeLoadThread.daemon = True - # self._gcodeLoadThread.start() - # - - # - # if self._gcode is not None and self._gcode.layerList is not None: - # glPushMatrix() - # if profile.getMachineSetting('machine_center_is_zero') != 'True': - # glTranslate(-self._machineSize[0] / 2, -self._machineSize[1] / 2, 0) - # t = time.time() - # drawUpTill = min(len(self._gcode.layerList), self.layerSelect.getValue() + 1) - # for n in xrange(0, drawUpTill): - # c = 1.0 - float(drawUpTill - n) / 15 - # c = max(0.3, c) - # if len(self._gcodeVBOs) < n + 1: - # self._gcodeVBOs.append(self._generateGCodeVBOs(self._gcode.layerList[n])) - # if time.time() - t > 0.5: - # self.QueueRefresh() - # break - # #['WALL-OUTER', 'WALL-INNER', 'FILL', 'SUPPORT', 'SKIRT'] - # if n == drawUpTill - 1: - # if len(self._gcodeVBOs[n]) < 9: - # self._gcodeVBOs[n] += self._generateGCodeVBOs2(self._gcode.layerList[n]) - # glColor3f(c, 0, 0) - # self._gcodeVBOs[n][8].render(GL_QUADS) - # glColor3f(c/2, 0, c) - # self._gcodeVBOs[n][9].render(GL_QUADS) - # glColor3f(0, c, c/2) - # self._gcodeVBOs[n][10].render(GL_QUADS) - # glColor3f(c, 0, 0) - # self._gcodeVBOs[n][11].render(GL_QUADS) - # - # glColor3f(0, c, 0) - # self._gcodeVBOs[n][12].render(GL_QUADS) - # glColor3f(c/2, c/2, 0.0) - # self._gcodeVBOs[n][13].render(GL_QUADS) - # glColor3f(0, c, c) - # self._gcodeVBOs[n][14].render(GL_QUADS) - # self._gcodeVBOs[n][15].render(GL_QUADS) - # glColor3f(0, 0, c) - # self._gcodeVBOs[n][16].render(GL_LINES) - # else: - # glColor3f(c, 0, 0) - # self._gcodeVBOs[n][0].render(GL_LINES) - # glColor3f(c/2, 0, c) - # self._gcodeVBOs[n][1].render(GL_LINES) - # glColor3f(0, c, c/2) - # self._gcodeVBOs[n][2].render(GL_LINES) - # glColor3f(c, 0, 0) - # self._gcodeVBOs[n][3].render(GL_LINES) - # - # glColor3f(0, c, 0) - # self._gcodeVBOs[n][4].render(GL_LINES) - # glColor3f(c/2, c/2, 0.0) - # self._gcodeVBOs[n][5].render(GL_LINES) - # glColor3f(0, c, c) - # self._gcodeVBOs[n][6].render(GL_LINES) - # self._gcodeVBOs[n][7].render(GL_LINES) - # glPopMatrix() - # - # def _generateGCodeVBOs(self, layer): - # ret = [] - # for extrudeType in ['WALL-OUTER:0', 'WALL-OUTER:1', 'WALL-OUTER:2', 'WALL-OUTER:3', 'WALL-INNER', 'FILL', 'SUPPORT', 'SKIRT']: - # if ':' in extrudeType: - # extruder = int(extrudeType[extrudeType.find(':')+1:]) - # extrudeType = extrudeType[0:extrudeType.find(':')] - # else: - # extruder = None - # pointList = numpy.zeros((0,3), numpy.float32) - # for path in layer: - # if path['type'] == 'extrude' and path['pathType'] == extrudeType and (extruder is None or path['extruder'] == extruder): - # a = path['points'] - # a = numpy.concatenate((a[:-1], a[1:]), 1) - # a = a.reshape((len(a) * 2, 3)) - # pointList = numpy.concatenate((pointList, a)) - # ret.append(opengl.GLVBO(pointList)) - # return ret - # - # def _generateGCodeVBOs2(self, layer): - # filamentRadius = profile.getProfileSettingFloat('filament_diameter') / 2 - # filamentArea = math.pi * filamentRadius * filamentRadius - # useFilamentArea = profile.getMachineSetting('gcode_flavor') == 'UltiGCode' - # - # ret = [] - # for extrudeType in ['WALL-OUTER:0', 'WALL-OUTER:1', 'WALL-OUTER:2', 'WALL-OUTER:3', 'WALL-INNER', 'FILL', 'SUPPORT', 'SKIRT']: - # if ':' in extrudeType: - # extruder = int(extrudeType[extrudeType.find(':')+1:]) - # extrudeType = extrudeType[0:extrudeType.find(':')] - # else: - # extruder = None - # pointList = numpy.zeros((0,3), numpy.float32) - # for path in layer: - # if path['type'] == 'extrude' and path['pathType'] == extrudeType and (extruder is None or path['extruder'] == extruder): - # a = path['points'] - # if extrudeType == 'FILL': - # a[:,2] += 0.01 - # - # normal = a[1:] - a[:-1] - # lens = numpy.sqrt(normal[:,0]**2 + normal[:,1]**2) - # normal[:,0], normal[:,1] = -normal[:,1] / lens, normal[:,0] / lens - # normal[:,2] /= lens - # - # ePerDist = path['extrusion'][1:] / lens - # if useFilamentArea: - # lineWidth = ePerDist / path['layerThickness'] / 2.0 - # else: - # lineWidth = ePerDist * (filamentArea / path['layerThickness'] / 2) - # - # normal[:,0] *= lineWidth - # normal[:,1] *= lineWidth - # - # b = numpy.zeros((len(a)-1, 0), numpy.float32) - # b = numpy.concatenate((b, a[1:] + normal), 1) - # b = numpy.concatenate((b, a[1:] - normal), 1) - # b = numpy.concatenate((b, a[:-1] - normal), 1) - # b = numpy.concatenate((b, a[:-1] + normal), 1) - # b = b.reshape((len(b) * 4, 3)) - # - # if len(a) > 2: - # normal2 = normal[:-1] + normal[1:] - # lens2 = numpy.sqrt(normal2[:,0]**2 + normal2[:,1]**2) - # normal2[:,0] /= lens2 - # normal2[:,1] /= lens2 - # normal2[:,0] *= lineWidth[:-1] - # normal2[:,1] *= lineWidth[:-1] - # - # c = numpy.zeros((len(a)-2, 0), numpy.float32) - # c = numpy.concatenate((c, a[1:-1]), 1) - # c = numpy.concatenate((c, a[1:-1]+normal[1:]), 1) - # c = numpy.concatenate((c, a[1:-1]+normal2), 1) - # c = numpy.concatenate((c, a[1:-1]+normal[:-1]), 1) - # - # c = numpy.concatenate((c, a[1:-1]), 1) - # c = numpy.concatenate((c, a[1:-1]-normal[1:]), 1) - # c = numpy.concatenate((c, a[1:-1]-normal2), 1) - # c = numpy.concatenate((c, a[1:-1]-normal[:-1]), 1) - # - # c = c.reshape((len(c) * 8, 3)) - # - # pointList = numpy.concatenate((pointList, b, c)) - # else: - # pointList = numpy.concatenate((pointList, b)) - # ret.append(opengl.GLVBO(pointList)) - # - # pointList = numpy.zeros((0,3), numpy.float32) - # for path in layer: - # if path['type'] == 'move': - # a = path['points'] + numpy.array([0,0,0.01], numpy.float32) - # a = numpy.concatenate((a[:-1], a[1:]), 1) - # a = a.reshape((len(a) * 2, 3)) - # pointList = numpy.concatenate((pointList, a)) - # if path['type'] == 'retract': - # a = path['points'] + numpy.array([0,0,0.01], numpy.float32) - # a = numpy.concatenate((a[:-1], a[1:] + numpy.array([0,0,1], numpy.float32)), 1) - # a = a.reshape((len(a) * 2, 3)) - # pointList = numpy.concatenate((pointList, a)) - # ret.append(opengl.GLVBO(pointList)) - # - # return ret