First cura integration attempt
This commit is contained in:
1 parent
c24a66c361
commit
281ad0f046
7 files changed
+1683
No files matched your search
@@ -0,0 +1 @@
|
||||
''
|
||||
@@ -0,0 +1,45 @@
|
||||
__author__ = "Ross Hendrickson savorywatt"
|
||||
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
class CuraWrapper(object):
|
||||
|
||||
CURA_PATH = '/home/rosshendrickson/workspaces/opensource/CuraEngine/CuraEngine'
|
||||
|
||||
@staticmethod
|
||||
def create_slicer(path=None):
|
||||
|
||||
if path:
|
||||
return CuraEngine(path)
|
||||
else:
|
||||
return CuraEngine(CuraWrapper.CURA_PATH)
|
||||
|
||||
|
||||
|
||||
class CuraEngine(object):
|
||||
|
||||
def __init__(self, cura_path):
|
||||
|
||||
|
||||
self.cura_path = cura_path
|
||||
|
||||
logging.info('CuraEngine Created')
|
||||
|
||||
|
||||
def process_file(self, config, gcode, file_path):
|
||||
"""Wraps around the main.cpp processFile method.
|
||||
|
||||
:param config: :class: `string` :path to a cura config file:
|
||||
:param gcode: :class: `string :path to write out the gcode generated:
|
||||
:param file_path: :class: `string :path to the STL to be sliced:
|
||||
|
||||
:note This just uses subprocess at the moment.
|
||||
"""
|
||||
|
||||
args = [self.cura_path, '-s', config, '-o', gcode, file_path]
|
||||
logging.info('CuraEngine args:%s' % str(args))
|
||||
|
||||
process = subprocess.call(args)
|
||||
logging.info('CuraEngine Exit:%s' % str(process))
|
||||
@@ -0,0 +1,11 @@
|
||||
;Generated with Cura_SteamEngine 1.0
|
||||
M107
|
||||
M104 S0 ;extruder heater off
|
||||
M140 S0 ;heated bed heater off (if you have it)
|
||||
G91 ;relative positioning
|
||||
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
|
||||
G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more
|
||||
G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
|
||||
M84 ;steppers off
|
||||
G90 ;absolute positioning
|
||||
|
||||
Whitespace-only changes.
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from cura import CuraWrapper
|
||||
from cura import CuraEngine
|
||||
|
||||
class CuraWrapperTestCase(unittest.TestCase):
|
||||
|
||||
|
||||
def test_cura_wrapper(self):
|
||||
|
||||
fake_path = 'my/temp/path'
|
||||
result = CuraWrapper.create_slicer(fake_path)
|
||||
|
||||
self.assertEqual(fake_path, result.cura_path)
|
||||
|
||||
def test_cura_engine_process_file(self):
|
||||
|
||||
cura_engine = CuraWrapper.create_slicer()
|
||||
|
||||
file_path = '/cura/tests/test.stl'
|
||||
config_path = '/cura/tests/config'
|
||||
gcode_filename= 'output.gcode'
|
||||
|
||||
cura_engine.process_file(config_path, gcode_filename, file_path)
|
||||
|
||||
|
||||
Reference in new issue
Block a user