Exemplo n.º 1
0
    def processStl(self, absolutePath, destination, uploadCallback=None):
        from octoprint.slicers.cura import CuraFactory

        cura = CuraFactory.create_slicer()
        gcodePath = genGcodeFileName(absolutePath)
        config = settings.get("cura", "config")

        slicingStart = time.time()

        def stlProcessed(stlPath, gcodePath, error=None):
            if error:
                eventManager().fire("SlicingFailed", {"stl": self._getBasicFilename(
                    stlPath), "gcode": self._getBasicFilename(gcodePath), "reason": error})
                if os.path.exists(stlPath):
                    os.remove(stlPath)
            else:
                slicingStop = time.time()
                eventManager().fire("SlicingDone", {"stl": self._getBasicFilename(
                    stlPath), "gcode": self._getBasicFilename(gcodePath), "time": "%.2f" % (slicingStop - slicingStart)})
                self.processGcode(gcodePath, destination, uploadCallback)

        eventManager().fire("SlicingStarted", {"stl": self._getBasicFilename(
            absolutePath), "gcode": self._getBasicFilename(gcodePath)})
        cura.process_file(
            config, gcodePath, absolutePath, stlProcessed, [absolutePath, gcodePath])
Exemplo n.º 2
0
	def test_cura_engine_process_file(self, thread):
		path = 'rosshendrickson/workspaces/opensource/CuraEngine/'
		
		cura = CuraFactory.create_slicer(path)
		file_path = './cura/tests/test.stl'
		config_path = './cura/tests/config'
		gcode_filename = './cura/tests/output.gcode'

		cura.process_file(config_path, gcode_filename, file_path)
		self.assertTrue(thread.called)
Exemplo n.º 3
0
    def processStl(self, absolutePath, destination, uploadCallback=None):
        from octoprint.slicers.cura import CuraFactory

        cura = CuraFactory.create_slicer()
        gcodePath = genGcodeFileName(absolutePath)
        config = self._settings.get(["cura", "config"])

        slicingStart = time.time()

        def stlProcessed(stlPath, gcodePath, error=None):
            if error:
                eventManager().fire(
                    Events.SLICING_FAILED, {
                        "stl": self._getBasicFilename(stlPath),
                        "gcode": self._getBasicFilename(gcodePath),
                        "reason": error
                    })
                if os.path.exists(stlPath):
                    os.remove(stlPath)
            else:
                slicingStop = time.time()
                eventManager().fire(
                    Events.SLICING_DONE, {
                        "stl": self._getBasicFilename(stlPath),
                        "gcode": self._getBasicFilename(gcodePath),
                        "time": slicingStop - slicingStart
                    })
                self.processGcode(gcodePath, destination, uploadCallback)

        eventManager().fire(
            Events.SLICING_STARTED, {
                "stl": self._getBasicFilename(absolutePath),
                "gcode": self._getBasicFilename(gcodePath)
            })
        cura.process_file(config, gcodePath, absolutePath, stlProcessed,
                          [absolutePath, gcodePath])

        return self._getBasicFilename(gcodePath)
Exemplo n.º 4
0
	def test_cura_factory(self):

		fake_path = 'my/temp/path'
		result = CuraFactory.create_slicer(fake_path)

		self.assertEqual(fake_path, result.cura_path)