public function slice() { $cr = 0; $status_current = NULL; $array_cartridge = array(); $custom_change = FALSE; $this->load->helper('slicer'); // we bypass this call when checking status block in slicing to make possible for local slicing callback // so we have to check printer is really in remote slicing case when calling this function (return error if not so) CoreStatus_checkInIdle($status_current); if ($status_current == CORESTATUS_VALUE_SLICE && !file_exists(SLICER_FILE_REMOTE_STATUS)) { $this->_exitWithError500(ERROR_BUSY_PRINTER . ' ' . t(MyERRMSG(ERROR_BUSY_PRINTER)), ERROR_BUSY_PRINTER); return; // never reach here } // check platform and filament present (do not check filament quantity) $cr = Slicer_checkPlatformColor($array_cartridge, $custom_change); if ($cr == ERROR_OK) { $cr = Slicer_changeTemperByCartridge($array_cartridge, $this->config->item('heat_bed')); } // start slice command after checking filament if ($cr == ERROR_OK) { $remote_slice = FALSE === $this->input->get('local') ? TRUE : FALSE; $cr = Slicer_slice($remote_slice && !$custom_change); } $this->_return_cr($cr); return; }
function slice_model_ajax() { $cr = 0; $array_cartridge = array(); $display = NULL; $id_preset = $this->input->get('id'); // $density = $this->input->get('density'); // $skirt = $this->input->get('skirt'); // $raft = $this->input->get('raft'); // $support = $this->input->get('support'); $heat_bed = $this->config->item('heat_bed') && (int) $this->input->get('hb') > 0; $array_setting = array(); $custom_change = FALSE; $this->load->helper('slicer'); // set and load preset into slicer if ($id_preset) { if ($id_preset == 'previous') { $cr = ZimAPI_getPreset($id_preset); } else { $cr = ZimAPI_setPreset($id_preset); } } else { $cr = ERROR_MISS_PRM; } if ($cr == ERROR_OK) { $cr = Slicer_reloadPreset(); } // load 4 extra parameters //TODO finish me (syntax in comment need be changed to function) // if ($density !== FALSE) { // if (FALSE == strpos('%', $density)) { // $density = (float)$density; // if ($density <= 0 || $density >= 1) { // $cr = ERROR_MISS_PRM; // break; // } // } // $array_setting['fill_density'] = $density; // } // if ($skirt !== FALSE) { // $array_setting['skirts'] = ((int)$skirt == 1) ? 1 : 0; // } // if ($raft !== FALSE) { // $array_setting['raft_layers'] = ((int)$raft == 1) ? 1 : 0; // } // if ($support !== FALSE) { // $array_setting['support_material'] = ((int)$support == 1) ? 1 : 0; // } // if (count($array_setting) == 0) { // $cr = ERROR_MISS_PRM; // } // else if ($cr == ERROR_OK) { // $cr = Slicer_changeParameter($array_setting); // } // check platform and filament present (do not check filament quantity) if ($cr == ERROR_OK) { $cr = Slicer_checkPlatformColor($array_cartridge, $custom_change); } if ($cr == ERROR_OK) { $cr = Slicer_changeTemperByCartridge($array_cartridge, $heat_bed); } // start slice command after checking filament if ($cr == ERROR_OK) { // we prefer to slice remotely except modified AMF if ($this->config->item('simulator')) { $custom_change = TRUE; // force local slicing for simulator } $cr = Slicer_slice(!$custom_change); } $display = $cr . " " . t(MyERRMSG($cr)); $this->output->set_status_header($cr, $display); $this->output->set_content_type('txt_u'); $this->load->library('parser'); $this->parser->parse('plaintxt', array('display' => $display)); //optional return; }