def slicing(input_file, output_file, input_settings_file, input_settings_dict, output_settings_file, scan_line, progress): progress.set_size(5) settings = SlicerSettings(file_name=input_settings_file, flat_settings_dict=input_settings_dict) progress.inc() if output_settings_file is not None: settings.write_file(output_settings_file) progress.inc() result = import_file(input_file, settings) progress.inc() if scan_line: result = slice_model(result, settings, slicer_class=ScanlineSlicer) else: result = slice_model(result, settings) progress.inc() result = encode(result, settings, output_file, scan_line) progress.done() return result
def setUp(self): self.s = get_test_settings() tm = import_file(TEST_FILE_CUBE, self.s) lm = slice_model(tm, self.s) self.gcode = get_gcode_filename() encode(lm, self.s, self.gcode) print 'G-code file:', self.gcode
def can_import(self, file_path, desc): with open(file_path) as f: contents = f.read() if desc['type'] is 'bin': self.assertTrue(StlBinImporter.can_import(contents)) self.assertFalse(StlAsciiImporter.can_import(contents)) elif desc['type'] is 'ascii': self.assertFalse(StlBinImporter.can_import(contents)) self.assertTrue(StlAsciiImporter.can_import(contents)) else: self.fail('Importer not supported') result = import_file(file_path, self.settings) check_result(self, result, desc)
def setUp(self): self.s = get_test_settings() tm = import_file(TEST_FILE_CUBE, self.s) self.model = slice_model(tm, self.s) self.layers = self.model.layers.values()