chiark / gitweb /
Proper fix for #518 by animacide. Update for UltiGCode GCode viewing.
authordaid <daid303@gmail.com>
Thu, 22 Aug 2013 11:56:39 +0000 (13:56 +0200)
committerdaid <daid303@gmail.com>
Thu, 22 Aug 2013 11:56:39 +0000 (13:56 +0200)
Cura/gui/sceneView.py
Cura/util/gcodeInterpreter.py

index 62a6da2af6ff20a61481b6d9712c28dee998220f..5b59e78a814fddd7054d3dbe2de8eb8b05e9ee58 100644 (file)
@@ -885,7 +885,8 @@ void main(void)
                                self._gcodeLoadThread.start()
                        if self._gcode is not None and self._gcode.layerList is not None:
                                glPushMatrix()
-                               glTranslate(-self._machineSize[0] / 2, -self._machineSize[1] / 2, 0)
+                               if profile.getPreference('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):
@@ -1224,6 +1225,7 @@ void main(void)
        def _generateGCodeVBOs2(self, layer):
                filamentRadius = profile.getProfileSettingFloat('filament_diameter') / 2
                filamentArea = math.pi * filamentRadius * filamentRadius
+               useFilamentArea = profile.getPreference('gcode_flavor') == 'UltiGCode'
 
                ret = []
                for extrudeType in ['WALL-OUTER:0', 'WALL-OUTER:1', 'WALL-OUTER:2', 'WALL-OUTER:3', 'WALL-INNER', 'FILL', 'SUPPORT', 'SKIRT']:
@@ -1245,7 +1247,10 @@ void main(void)
                                        normal[:,2] /= lens
 
                                        ePerDist = path['extrusion'][1:] / lens
-                                       lineWidth = ePerDist * (filamentArea / path['layerThickness'] / 2)
+                                       if useFilamentArea:
+                                               lineWidth = ePerDist / path['layerThickness'] / 2.0
+                                       else:
+                                               lineWidth = ePerDist * (filamentArea / path['layerThickness'] / 2)
 
                                        normal[:,0] *= lineWidth
                                        normal[:,1] *= lineWidth
index 15f16279080499123c3135b36592f206dde7ab80..c13b0bf2b99bf63a6fcee8dbce0d790d196ccdd9 100644 (file)
@@ -63,7 +63,7 @@ class gcode(object):
        
        def _load(self, gcodeFile):
                self.layerList = []
-               pos = [0.0, 0.0, 0.0]
+               pos = [0.0,0.0,0.0]
                posOffset = [0.0, 0.0, 0.0]
                currentE = 0.0
                totalExtrusion = 0.0
@@ -194,10 +194,7 @@ class gcode(object):
                                        x = getCodeFloat(line, 'X')
                                        y = getCodeFloat(line, 'Y')
                                        z = getCodeFloat(line, 'Z')
-                                       if profile.getPreference('machine_center_is_zero') == 'True':
-                                               center = [profile.getProfileSettingFloat('machine_width') / 2, profile.getProfileSettingFloat('machine_depth') / 2,0.0]
-                                       else:
-                                               center = [0.0,0.0,0.0]
+                                       center = [0.0,0.0,0.0]
                                        if x is None and y is None and z is None:
                                                pos = center
                                        else: