MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / extrude

Method extrude

src/astroprint/plugin/services/printer.py:287–314  ·  view source on GitHub ↗
(self,data,callback)

Source from the content-addressed store, hash-verified

285 callback({'success': 'no_error'})
286
287 def extrude(self,data,callback):
288
289 pm = printerManager()
290
291 if not pm.isOperational():
292 callback("Printer is not operational", True)
293 return
294
295 if pm.isPrinting():
296 # do not extrude when a print job is running
297 callback("Printer is currently printing", True)
298 return
299
300 amount = data["amount"]
301 speed = data["speed"]
302 tool = data["tool"]
303
304 if not isinstance(amount, (int, long, float)):
305 callback("Not a number for extrusion amount: " + amount, True)
306 return
307
308 if speed and not isinstance(speed, (int, long, float)):
309 speed = None
310
311 pm.extrude(tool, amount, speed)
312
313 callback({'success': 'no_error'})
314 return
315
316 def getNumberOfExtruders(self,data,sendResponse=None):
317 ppm = printerProfileManager()

Callers

nothing calls this directly

Calls 4

printerManagerFunction · 0.90
callbackFunction · 0.50
isOperationalMethod · 0.45
isPrintingMethod · 0.45

Tested by

no test coverage detected