Change Class name. Test will slice model with included ini.
This commit is contained in:
parent
0eeca11838
commit
280d8e8405
4 changed files with 153 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -4,6 +4,8 @@
|
|||
*.pyc
|
||||
*.zip
|
||||
*.exe
|
||||
*.gcode
|
||||
*.swp
|
||||
darwin-Cura-*
|
||||
win32-Cura-*
|
||||
linux-Cura-*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agp
|
|||
import logging
|
||||
import subprocess
|
||||
|
||||
class CuraWrapper(object):
|
||||
class CuraFactory(object):
|
||||
|
||||
CURA_PATH = '/home/rosshendrickson/workspaces/opensource/CuraEngine/CuraEngine'
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ class CuraWrapper(object):
|
|||
if path:
|
||||
return CuraEngine(path)
|
||||
else:
|
||||
return CuraEngine(CuraWrapper.CURA_PATH)
|
||||
return CuraEngine(CuraFactory.CURA_PATH)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
141
octoprint/cura/tests/test.ini
Normal file
141
octoprint/cura/tests/test.ini
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
[profile]
|
||||
layer_height = 0.1
|
||||
wall_thickness = 1.0
|
||||
retraction_enable = False
|
||||
solid_layer_thickness = 0.6
|
||||
fill_density = 20
|
||||
nozzle_size = 0.5
|
||||
print_speed = 50
|
||||
print_temperature = 220
|
||||
print_temperature2 = 0
|
||||
print_temperature3 = 0
|
||||
print_temperature4 = 0
|
||||
print_bed_temperature = 70
|
||||
support = None
|
||||
platform_adhesion = None
|
||||
support_dual_extrusion = False
|
||||
filament_diameter = 2.89
|
||||
filament_diameter2 = 0
|
||||
filament_diameter3 = 0
|
||||
filament_diameter4 = 0
|
||||
filament_flow = 100.0
|
||||
retraction_speed = 40.0
|
||||
retraction_amount = 4.5
|
||||
retraction_dual_amount = 16.5
|
||||
bottom_thickness = 0.3
|
||||
object_sink = 0.0
|
||||
travel_speed = 150.0
|
||||
bottom_layer_speed = 20
|
||||
infill_speed = 0.0
|
||||
cool_min_layer_time = 5
|
||||
fan_enabled = True
|
||||
skirt_line_count = 1
|
||||
skirt_gap = 3.0
|
||||
fan_layer = 1
|
||||
fan_speed = 100
|
||||
fan_speed_max = 100
|
||||
cool_min_feedrate = 10
|
||||
cool_head_lift = False
|
||||
solid_top = True
|
||||
solid_bottom = True
|
||||
fill_overlap = 15
|
||||
support_rate = 75
|
||||
brim_line_count = 20
|
||||
raft_margin = 5
|
||||
raft_line_spacing = 1.0
|
||||
raft_base_thickness = 0.3
|
||||
raft_base_linewidth = 0.7
|
||||
raft_interface_thickness = 0.2
|
||||
raft_interface_linewidth = 0.2
|
||||
fix_horrible_union_all_type_a = False
|
||||
fix_horrible_union_all_type_b = False
|
||||
fix_horrible_use_open_bits = False
|
||||
fix_horrible_extensive_stitching = False
|
||||
plugin_config = (lp1
|
||||
.
|
||||
object_center_x = -1
|
||||
object_center_y = -1
|
||||
|
||||
[alterations]
|
||||
start.gcode = ;Sliced at: {day} {date} {time}
|
||||
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
|
||||
;Print time: {print_time}
|
||||
;Filament used: {filament_amount}m {filament_weight}g
|
||||
;Filament cost: {filament_cost}
|
||||
G21 ;metric values
|
||||
G90 ;absolute positioning
|
||||
M107 ;start with the fan off
|
||||
G28 X0 Y0 ;move X/Y to min endstops
|
||||
G28 Z0 ;move Z to min endstops
|
||||
G1 Z15.0 F{travel_speed} ;move the platform down 15mm
|
||||
G92 E0 ;zero the extruded length
|
||||
G1 F200 E3 ;extrude 3mm of feed stock
|
||||
G92 E0 ;zero the extruded length again
|
||||
G1 F{travel_speed}
|
||||
M117 Printing...
|
||||
end.gcode = ;End GCode
|
||||
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 F{travel_speed} ;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
|
||||
start2.gcode = ;Sliced at: {day} {date} {time}
|
||||
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
|
||||
;Print time: {print_time}
|
||||
;Filament used: {filament_amount}m {filament_weight}g
|
||||
;Filament cost: {filament_cost}
|
||||
G21 ;metric values
|
||||
G90 ;absolute positioning
|
||||
M107 ;start with the fan off
|
||||
G28 X0 Y0 ;move X/Y to min endstops
|
||||
G28 Z0 ;move Z to min endstops
|
||||
G1 Z15.0 F{travel_speed} ;move the platform down 15mm
|
||||
T1
|
||||
G92 E0 ;zero the extruded length
|
||||
G1 F200 E10 ;extrude 10mm of feed stock
|
||||
G92 E0 ;zero the extruded length again
|
||||
G1 F200 E-{retraction_dual_amount}
|
||||
T0
|
||||
G92 E0 ;zero the extruded length
|
||||
G1 F200 E10 ;extrude 10mm of feed stock
|
||||
G92 E0 ;zero the extruded length again
|
||||
G1 F{travel_speed}
|
||||
M117 Printing...
|
||||
end2.gcode = ;End GCode
|
||||
M104 T0 S0 ;extruder heater off
|
||||
M104 T1 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 F{travel_speed} ;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
|
||||
support_start.gcode =
|
||||
support_end.gcode =
|
||||
cool_start.gcode =
|
||||
cool_end.gcode =
|
||||
replace.csv =
|
||||
nextobject.gcode = ;Move to next object on the platform. clear_z is the minimal z height we need to make sure we do not hit any objects.
|
||||
G92 E0
|
||||
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 F{travel_speed} ;move Z up a bit and retract filament even more
|
||||
G90 ;absolute positioning
|
||||
G1 Z{clear_z} F{max_z_speed}
|
||||
G92 E0
|
||||
G1 X{object_center_x} Y{object_center_y} F{travel_speed}
|
||||
G1 F200 E6
|
||||
G92 E0
|
||||
switchextruder.gcode = ;Switch between the current extruder and the next extruder, when printing with multiple extruders.
|
||||
G92 E0
|
||||
G1 E-36 F5000
|
||||
G92 E0
|
||||
T{extruder}
|
||||
G1 X{new_x} Y{new_y} Z{new_z} F{travel_speed}
|
||||
G1 E36 F5000
|
||||
G92 E0
|
||||
|
||||
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from cura import CuraWrapper
|
||||
from cura import CuraFactory
|
||||
from cura import CuraEngine
|
||||
|
||||
class CuraWrapperTestCase(unittest.TestCase):
|
||||
class CuraFactoryTestCase(unittest.TestCase):
|
||||
|
||||
|
||||
def test_cura_wrapper(self):
|
||||
def test_cura_factory(self):
|
||||
|
||||
fake_path = 'my/temp/path'
|
||||
result = CuraWrapper.create_slicer(fake_path)
|
||||
result = CuraFactory.create_slicer(fake_path)
|
||||
|
||||
self.assertEqual(fake_path, result.cura_path)
|
||||
|
||||
def test_cura_engine_process_file(self):
|
||||
|
||||
cura_engine = CuraWrapper.create_slicer()
|
||||
cura_engine = CuraFactory.create_slicer()
|
||||
|
||||
file_path = '/cura/tests/test.stl'
|
||||
config_path = '/cura/tests/config'
|
||||
gcode_filename= 'output.gcode'
|
||||
file_path = './cura/tests/test_02.stl'
|
||||
config_path = './cura/tests/config'
|
||||
gcode_filename= './cura/tests/output.gcode'
|
||||
|
||||
cura_engine.process_file(config_path, gcode_filename, file_path)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue