int MeshGroup::getExtruderCount() const { if (extruder_count == -1) { extruder_count = getSettingAsCount("machine_extruder_count"); } return extruder_count; }
void LayerPlanBuffer::insertPreheatCommand(std::vector<GCodePlanner*>& layers, unsigned int layer_plan_idx, unsigned int extruder_plan_idx) { ExtruderPlan& extruder_plan = layers[layer_plan_idx]->extruder_plans[extruder_plan_idx]; int extruder = extruder_plan.extruder; double required_temp = extruder_plan.required_temp; ExtruderPlan* prev_extruder_plan = nullptr; if (extruder_plan_idx == 0) { if (layer_plan_idx == 0) { // the very first extruder plan for (int extruder_idx = 0; extruder_idx < getSettingAsCount("machine_extruder_count"); extruder_idx++) { // set temperature of the first nozzle, turn other nozzles down if (extruder_idx == extruder) { // extruder_plan.insertCommand(0, extruder, required_temp, true); // the first used extruder should already be set to the required temp in the start gcode } else { extruder_plan.insertCommand(0, extruder_idx, preheat_config.getStandbyTemp(extruder_idx), false); } } return; } prev_extruder_plan = &layers[layer_plan_idx - 1]->extruder_plans.back(); } else { prev_extruder_plan = &layers[layer_plan_idx]->extruder_plans[extruder_plan_idx - 1]; } assert(prev_extruder_plan != nullptr); int prev_extruder = prev_extruder_plan->extruder; if (prev_extruder != extruder) { // set previous extruder to standby temperature prev_extruder_plan->insertCommand(prev_extruder_plan->paths.size(), prev_extruder, preheat_config.getStandbyTemp(prev_extruder), false); } if (prev_extruder == extruder) { if (preheat_config.usesFlowDependentTemp(extruder)) { insertPreheatCommand_singleExtrusion(*prev_extruder_plan, extruder, required_temp); } } else { insertPreheatCommand_multiExtrusion(layers, layer_plan_idx, extruder_plan_idx); } }
void FffPolygonGenerator::processPlatformAdhesion(SliceDataStorage& storage) { switch(getSettingAsPlatformAdhesion("adhesion_type")) { case EPlatformAdhesion::SKIRT: if (getSettingInMicrons("draft_shield_height") == 0) { // draft screen replaces skirt generateSkirt(storage, getSettingInMicrons("skirt_gap"), getSettingAsCount("skirt_line_count"), getSettingInMicrons("skirt_minimal_length")); } break; case EPlatformAdhesion::BRIM: generateSkirt(storage, 0, getSettingAsCount("brim_line_count"), getSettingInMicrons("skirt_minimal_length")); break; case EPlatformAdhesion::RAFT: generateRaft(storage, getSettingInMicrons("raft_margin")); break; } Polygons skirt_sent = storage.skirt[0]; for (int extruder = 1; extruder < storage.meshgroup->getExtruderCount(); extruder++) skirt_sent.add(storage.skirt[extruder]); }
ExtruderTrain* MeshGroup::createExtruderTrain(unsigned int extruder_nr) { assert((int)extruder_nr >= 0 && (int)extruder_nr < getSettingAsCount("machine_extruder_count") && "only valid extruder trains may be requested!"); if (!extruders[extruder_nr]) { extruders[extruder_nr] = new ExtruderTrain(this, extruder_nr); int err = SettingRegistry::getInstance()->loadExtruderJSONsettings(extruder_nr, extruders[extruder_nr]); if (err) { logError("Couldn't load extruder.def.json for extruder %i\n", extruder_nr); std::exit(1); } } return extruders[extruder_nr]; }
void FffPolygonGenerator::processPlatformAdhesion(SliceDataStorage& storage) { switch(getSettingAsPlatformAdhesion("adhesion_type")) { case Adhesion_Skirt: if (getSettingInMicrons("draft_shield_height") == 0) { // draft screen replaces skirt generateSkirt(storage, getSettingInMicrons("skirt_gap"), getSettingInMicrons("skirt_line_width"), getSettingAsCount("skirt_line_count"), getSettingInMicrons("skirt_minimal_length")); } break; case Adhesion_Brim: generateSkirt(storage, 0, getSettingInMicrons("skirt_line_width"), getSettingAsCount("brim_line_count"), getSettingInMicrons("skirt_minimal_length")); break; case Adhesion_Raft: generateRaft(storage, getSettingInMicrons("raft_margin")); break; } sendPolygons(SkirtType, 0, storage.skirt, getSettingInMicrons("skirt_line_width")); }
void FffPolygonGenerator::slices2polygons(SliceDataStorage& storage, TimeKeeper& time_keeper) { if (commandSocket) commandSocket->beginSendSlicedObject(); // const unsigned int total_layers = storage.meshes.at(0).layers.size(); //layerparts2HTML(storage, "output/output.html"); for(unsigned int layer_number = 0; layer_number < total_layers; layer_number++) { processInsets(storage, layer_number); Progress::messageProgress(Progress::Stage::INSET, layer_number+1, total_layers, commandSocket); } removeEmptyFirstLayers(storage, getSettingInMicrons("layer_height"), total_layers); if (total_layers < 1) { log("Stopping process because there are no layers.\n"); return; } processOozeShield(storage, total_layers); Progress::messageProgressStage(Progress::Stage::SUPPORT, &time_keeper, commandSocket); for(SliceMeshStorage& mesh : storage.meshes) { generateSupportAreas(storage, &mesh, total_layers, commandSocket); for (unsigned int layer_idx = 0; layer_idx < total_layers; layer_idx++) { Polygons& support = storage.support.supportLayers[layer_idx].supportAreas; sendPolygons(SupportType, layer_idx, support, getSettingInMicrons("support_line_width")); } } if (getSettingBoolean("support_roof_enable")) { generateSupportRoofs(storage, commandSocket, getSettingInMicrons("layer_height"), getSettingInMicrons("support_roof_height")); } Progress::messageProgressStage(Progress::Stage::SKIN, &time_keeper, commandSocket); for(unsigned int layer_number = 0; layer_number < total_layers; layer_number++) { if (!getSettingBoolean("magic_spiralize") || static_cast<int>(layer_number) < getSettingAsCount("bottom_layers")) //Only generate up/downskin and infill for the first X layers when spiralize is choosen. { processSkins(storage, layer_number); } Progress::messageProgress(Progress::Stage::SKIN, layer_number+1, total_layers, commandSocket); } for(unsigned int layer_number = total_layers-1; layer_number > 0; layer_number--) { for(SliceMeshStorage& mesh : storage.meshes) combineSparseLayers(layer_number, mesh, mesh.settings->getSettingAsCount("fill_sparse_combine")); } processWipeTower(storage, total_layers); processDraftShield(storage, total_layers); processPlatformAdhesion(storage); }
void MeshGroup::finalize() { extruder_count = getSettingAsCount("machine_extruder_count"); for (int extruder_nr = 0; extruder_nr < extruder_count; extruder_nr++) { createExtruderTrain(extruder_nr); // create it if it didn't exist yet if (getSettingAsIndex("adhesion_extruder_nr") == extruder_nr && getSettingAsPlatformAdhesion("adhesion_type") != EPlatformAdhesion::NONE) { getExtruderTrain(extruder_nr)->setIsUsed(true); continue; } for (const Mesh& mesh : meshes) { if (mesh.getSettingBoolean("support_enable") && ( getSettingAsIndex("support_infill_extruder_nr") == extruder_nr || getSettingAsIndex("support_extruder_nr_layer_0") == extruder_nr || (getSettingBoolean("support_interface_enable") && getSettingAsIndex("support_interface_extruder_nr") == extruder_nr) ) ) { getExtruderTrain(extruder_nr)->setIsUsed(true); break; } } } for (const Mesh& mesh : meshes) { if (!mesh.getSettingBoolean("anti_overhang_mesh") && !mesh.getSettingBoolean("support_mesh") ) { getExtruderTrain(mesh.getSettingAsIndex("extruder_nr"))->setIsUsed(true); } } //If the machine settings have been supplied, offset the given position vertices to the center of vertices (0,0,0) is at the bed center. Point3 meshgroup_offset(0, 0, 0); if (!getSettingBoolean("machine_center_is_zero")) { meshgroup_offset.x = getSettingInMicrons("machine_width") / 2; meshgroup_offset.y = getSettingInMicrons("machine_depth") / 2; } // If a mesh position was given, put the mesh at this position in 3D space. for(Mesh& mesh : meshes) { Point3 mesh_offset(mesh.getSettingInMicrons("mesh_position_x"), mesh.getSettingInMicrons("mesh_position_y"), mesh.getSettingInMicrons("mesh_position_z")); if (mesh.getSettingBoolean("center_object")) { Point3 object_min = mesh.min(); Point3 object_max = mesh.max(); Point3 object_size = object_max - object_min; mesh_offset += Point3(-object_min.x - object_size.x / 2, -object_min.y - object_size.y / 2, -object_min.z); } mesh.offset(mesh_offset + meshgroup_offset); } }