chiark / gitweb /
Merge branch 'master' into SteamEngine
authordaid303 <daid303@gmail.com>
Mon, 11 Mar 2013 10:28:55 +0000 (11:28 +0100)
committerdaid303 <daid303@gmail.com>
Mon, 11 Mar 2013 10:28:55 +0000 (11:28 +0100)
1  2 
Cura/slice/__main__.py

diff --combined Cura/slice/__main__.py
index d3c313fd1c46979c18bf242d719720502b864b25,eecb3f4890d752fa3acd977bb1552c79b18ef421..261d90552901de841ebd99493b0d9f891273f796
@@@ -8,7 -8,6 +8,7 @@@ import urlli
  import urllib2
  import platform
  import hashlib
 +import subprocess
  
  if not hasattr(sys, 'frozen'):
        cura_sf_path = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "./cura_sf/"))
@@@ -16,6 -15,7 +16,7 @@@
                sys.path.append(cura_sf_path)
  
  from Cura.util import profile
+ from Cura.util import version
  from Cura.slice.cura_sf.skeinforge_application.skeinforge_plugins.craft_plugins import export
  
  def fixUTF8(input):
@@@ -37,54 -37,6 +38,54 @@@ def main()
                profile.loadGlobalProfileFromString(options.profile)
        options.output = fixUTF8(options.output)
  
 +      steamEngineFilename = os.path.join(os.path.dirname(__file__), 'SteamEngine')
 +      if platform.system() == "Windows":
 +              steamEngineFilename += ".exe"
 +              if os.path.isfile("C:\Software\Cura_SteamEngine\_bin\Release\Cura_SteamEngine.exe"):
 +                      steamEngineFilename = "C:\Software\Cura_SteamEngine\_bin\Release\Cura_SteamEngine.exe"
 +      if os.path.isfile(steamEngineFilename):
 +              for idx in xrange(0, len(args), 2):
 +                      position = map(float, args[idx].split(','))
 +                      if len(position) < 9 + 2:
 +                              position = position[0:2]
 +                              position += [1,0,0]
 +                              position += [0,1,0]
 +                              position += [0,0,1]
 +
 +                      settings = {}
 +                      settings['layerThickness'] = int(profile.getProfileSettingFloat('layer_height') * 1000)
 +                      settings['initialLayerThickness'] = int(profile.getProfileSettingFloat('bottom_thickness') * 1000)
 +                      settings['filamentDiameter'] = int(profile.getProfileSettingFloat('filament_diameter') * 1000)
 +                      settings['extrusionWidth'] = int(profile.calculateEdgeWidth() * 1000)
 +                      settings['insetCount'] = int(profile.calculateLineCount())
 +                      settings['downSkinCount'] = int(profile.calculateSolidLayerCount())
 +                      settings['upSkinCount'] = int(profile.calculateSolidLayerCount())
 +                      if profile.getProfileSettingFloat('fill_density') > 0:
 +                              settings['sparseInfillLineDistance'] = int(100 * 1000 * profile.calculateEdgeWidth() / profile.getProfileSettingFloat('fill_density'))
 +                      else:
 +                              settings['sparseInfillLineDistance'] = 9999999
 +                      settings['skirtDistance'] = int(profile.getProfileSettingFloat('skirt_gap') * 1000)
 +                      settings['skirtLineCount'] = int(profile.getProfileSettingFloat('skirt_line_count'))
 +
 +                      settings['initialSpeedupLayers'] = int(4)
 +                      settings['initialLayerSpeed'] = int(profile.getProfileSettingFloat('bottom_layer_speed'))
 +                      settings['printSpeed'] = int(profile.getProfileSettingFloat('print_speed'))
 +                      settings['moveSpeed'] = int(profile.getProfileSettingFloat('travel_speed'))
 +                      settings['fanOnLayerNr'] = int(profile.getProfileSettingFloat('fan_layer'))
 +
 +                      cmdList = [steamEngineFilename, args[idx+1], '-o', options.output, '-m', ','.join(map(str, position[2:]))]
 +                      for (key, value) in settings.items():
 +                              cmdList += ['-s', str(key) + "=" + str(value)]
 +                      kwargs = {}
 +                      if subprocess.mswindows:
 +                              su = subprocess.STARTUPINFO()
 +                              su.dwFlags |= subprocess.STARTF_USESHOWWINDOW
 +                              su.wShowWindow = subprocess.SW_HIDE
 +                              kwargs['startupinfo'] = su
 +                      p = subprocess.Popen(cmdList, **kwargs)
 +                      p.communicate()
 +              return
 +
        clearZ = 0
        resultFile = open(options.output, "w")
        for idx in xrange(0, len(args), 2):
                                'machine': platform.machine(),
                                'platform': platform.platform(),
                                'profile': profile.getGlobalProfileString(),
+                               'preferences': profile.getGlobalPreferencesString(),
                                'modelhash': m.hexdigest(),
+                               'version': version.getVersion(),
                        }
                        try:
-                               f = urllib2.urlopen("http://software.ultimaker.com/upload_stats.php", data = urllib.urlencode(data), timeout = 5);
+                               f = urllib2.urlopen("http://platform.ultimaker.com/curastats/", data = urllib.urlencode(data), timeout = 5);
                                f.read()
                                f.close()
                        except: