STL file no longer appears after slicing or reloading. First steps for slicing an moving file to SD card.
This commit is contained in:
parent
711d18d9ad
commit
f51f4ad5cd
7 changed files with 77 additions and 1764 deletions
|
|
@ -1,141 +0,0 @@
|
|||
[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
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -114,55 +114,61 @@ class GcodeManager:
|
|||
#~~ file handling
|
||||
|
||||
def addFile(self, file):
|
||||
from octoprint.filemanager.types import FileTypes
|
||||
from octoprint.util import isSTLFileName
|
||||
from octoprint.util import isGcodeFileName
|
||||
|
||||
if not file:
|
||||
return None
|
||||
|
||||
absolutePath = self.getAbsolutePath(file.filename, mustExist=False)
|
||||
logging.info("Abs Path %s" % absolutePath)
|
||||
|
||||
if absolutePath is None:
|
||||
return None
|
||||
|
||||
file.save(absolutePath)
|
||||
fileType = file.filename.rsplit(".", 1)[1]
|
||||
filename = file.filename
|
||||
|
||||
if not fileType:
|
||||
return None
|
||||
|
||||
if fileType == FileTypes.GCODE:
|
||||
return self.processGcode(file.filename, absolutePath)
|
||||
if isGcodeFileName(filename):
|
||||
return self.processGcode(absolutePath)
|
||||
|
||||
if fileType == FileTypes.STL:
|
||||
return self.processSTL(file.filename, absolutePath)
|
||||
if isSTLFileName(filename):
|
||||
gcodePath = util.genGcodeFileName(absolutePath)
|
||||
logging.info("FILENAME: %s" % filename)
|
||||
|
||||
def processSTL(self, filename, absolutePath):
|
||||
callBackArgs = [gcodePath]
|
||||
callBack = self.processGcode
|
||||
|
||||
return self.processSTL(
|
||||
filename, absolutePath, callBack, callBackArgs)
|
||||
|
||||
def processSTL(self, filename, absolutePath, callBack, callBackArgs):
|
||||
|
||||
from octoprint.cura import CuraFactory
|
||||
|
||||
callBack = self.processGcode
|
||||
gcodeFileName = util.genGcodeFileName(filename)
|
||||
gcodePath = util.genGcodeFileName(absolutePath)
|
||||
|
||||
callBackArgs = [gcodeFileName, gcodePath]
|
||||
|
||||
curaEngine = CuraFactory.create_slicer()
|
||||
current_settings = settings()
|
||||
|
||||
gcodePath = util.genGcodeFileName(absolutePath)
|
||||
|
||||
config = current_settings.get(["curaEngine", "config"])
|
||||
|
||||
curaEngine.process_file(
|
||||
config, gcodePath, absolutePath, callBack, callBackArgs)
|
||||
|
||||
return self._getBasicFilename(absolutePath)
|
||||
|
||||
def processGcode(self, filename, absolutePath):
|
||||
def processGcode(self, absolutePath):
|
||||
|
||||
filename = self._getBasicFilename(absolutePath)
|
||||
|
||||
if filename in self._metadata.keys():
|
||||
# delete existing metadata entry, since the file is going to get overwritten
|
||||
del self._metadata[filename]
|
||||
self._metadataDirty = True
|
||||
self._saveMetadata()
|
||||
|
||||
self._metadataAnalyzer.addFileToQueue(os.path.basename(absolutePath))
|
||||
return self._getBasicFilename(absolutePath)
|
||||
|
||||
return filename
|
||||
|
||||
def removeFile(self, filename):
|
||||
filename = self._getBasicFilename(filename)
|
||||
|
|
@ -209,7 +215,22 @@ class GcodeManager:
|
|||
return files
|
||||
|
||||
def getFileData(self, filename):
|
||||
from octoprint.filemanager.types import FileTypes
|
||||
|
||||
if not filename:
|
||||
return
|
||||
|
||||
filename = self._getBasicFilename(filename)
|
||||
|
||||
fileType = filename.rsplit(".", 1)[1]
|
||||
|
||||
if not fileType:
|
||||
return None
|
||||
|
||||
# TODO: Make this more robust when STLs will be viewable from the client
|
||||
if fileType != FileTypes.GCODE:
|
||||
return
|
||||
|
||||
absolutePath = self.getAbsolutePath(filename)
|
||||
if absolutePath is None:
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -467,12 +467,30 @@ class Printer():
|
|||
return
|
||||
return self._comm.getSdFiles()
|
||||
|
||||
def addSdFile(self, filename, file):
|
||||
def addSdFile(self, filename, absolutePath):
|
||||
from octoprint.util import isGcodeFileName
|
||||
from octoprint.util import isSTLFileName
|
||||
|
||||
if not self._comm:
|
||||
return
|
||||
|
||||
self._sdStreamer = SdFileStreamer(self._comm, filename, file, self._onSdFileStreamProgress, self._onSdFileStreamFinish)
|
||||
if isGcodeFileName(filename):
|
||||
self.streamSdFile(filename, absolutePath)
|
||||
|
||||
if isSTLFileName(filename):
|
||||
gcodePath = util.genGcodeFileName(absolutePath)
|
||||
callBackArgs = [filename, absolutePath]
|
||||
callBack = self.streamSdFile
|
||||
|
||||
gcodeManager = GcodeManager()
|
||||
gcodeManager.processSTL(
|
||||
filename, absolutePath, callBack, callBackArgs)
|
||||
|
||||
def streamSdFile(filename, absolutePath):
|
||||
|
||||
self._sdStreamer = SdFileStreamer(self._comm, filename, absolutePath, self._onSdFileStreamProgress, self._onSdFileStreamFinish)
|
||||
self._sdStreamer.start()
|
||||
logging.info("Stream file to SD started")
|
||||
|
||||
def deleteSdFile(self, filename):
|
||||
if not self._comm:
|
||||
|
|
|
|||
|
|
@ -308,12 +308,13 @@ def readGcodeFile(filename):
|
|||
@login_required
|
||||
def uploadGcodeFile():
|
||||
filename = None
|
||||
logging.info(str(request.files.keys()))
|
||||
|
||||
if "gcode_file" in request.files.keys():
|
||||
file = request.files["gcode_file"]
|
||||
filename = gcodeManager.addFile(file)
|
||||
if filename and "target" in request.values.keys() and request.values["target"] == "sd":
|
||||
printer.addSdFile(filename, gcodeManager.getAbsolutePath(filename))
|
||||
|
||||
return jsonify(files=gcodeManager.getAllFileData(), filename=filename)
|
||||
|
||||
@app.route(BASEURL + "gcodefiles/load", methods=["POST"])
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class FileManipulationTestCase(unittest.TestCase):
|
|||
|
||||
logging.info("RESULT:%s" % str(result))
|
||||
|
||||
self.assertTrue(fake.filename == result)
|
||||
self.assertIsNone(result)
|
||||
|
||||
self.assertTrue(process.called)
|
||||
|
||||
|
|
|
|||
|
|
@ -46,11 +46,23 @@ def matchesGcode(line, gcode):
|
|||
return re.search("^\s*%s\D" % gcode, line, re.I)
|
||||
|
||||
def isGcodeFileName(filename):
|
||||
"""Simple helper to determine if a filename has the .gcode extension.
|
||||
|
||||
:param filename: :class: `str`
|
||||
|
||||
:returns boolean:
|
||||
"""
|
||||
return "." in filename and filename.rsplit(".", 1)[1] in ["gcode", "GCODE"]
|
||||
|
||||
def isSTLFileName(filename):
|
||||
return "." in filename and filename.rsplit(".", 1)[1] in ["stl", "STL"]
|
||||
"""Simple helper to determine if a filename has the .stl extension.
|
||||
|
||||
:param filename: :class: `str`
|
||||
|
||||
:returns boolean:
|
||||
"""
|
||||
return "." in filename and filename.rsplit(".", 1)[1] in ["stl", "STL"]
|
||||
|
||||
def genGcodeFileName(filename):
|
||||
|
||||
if not filename:
|
||||
|
|
|
|||
Loading…
Reference in a new issue