Skip to content

Commit

Permalink
Merge pull request #51 from psycodelic/master
Browse files Browse the repository at this point in the history
Add version check for Prusa Slic3r 2 and use different args
  • Loading branch information
eyal0 authored Jul 26, 2019
2 parents df37d20 + b3b86e2 commit c7327e3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion octoprint_slic3r/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,23 @@ def do_slice(self, model_path, printer_profile, machinecode_path=None, profile_p
if not executable:
return False, "Path to Slic3r is not configured "

args = ['"%s"' % executable, '--load', '"%s"' % profile_path, '--print-center', '"%f,%f"' % (posX, posY), '-o', '"%s"' % machinecode_path, '"%s"' % model_path]

try:
import subprocess

help_process = subprocess.Popen((executable, '--help'), stdout=subprocess.PIPE)
help_text = help_process.communicate()[0]

if help_text.startswith('PrusaSlicer-2'):
args = ['"%s"' % executable, '--slice --load', '"%s"' % profile_path, '--center', '"%f,%f"' % (posX, posY), '-o', '"%s"' % machinecode_path, '"%s"' % model_path]
self._logger.info("Running Prusa Slic3r >= 2")
except:
self._logger.info("Error during Prusa Slic3r detection")

import sarge

working_dir, _ = os.path.split(executable)
args = ['"%s"' % executable, '--load', '"%s"' % profile_path, '--print-center', '"%f,%f"' % (posX, posY), '-o', '"%s"' % machinecode_path, '"%s"' % model_path]

command = " ".join(args)
self._logger.info("Running %r in %s" % (command, working_dir))
Expand Down

0 comments on commit c7327e3

Please sign in to comment.