mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-04 16:21:17 -07:00
NEW: add best_object_pos for auto-arranging
For i3 printers, best object position may not be the bed center, we need to align objects to the specified best_object_pos. Jira: STUDIO-4133 Change-Id: I06e31e597d2dd8288eb24a52d836cc8a134a4111
This commit is contained in:
parent
763cff046c
commit
e789489ed9
14 changed files with 49 additions and 23 deletions
|
|
@ -153,16 +153,16 @@ Points get_shrink_bedpts(const DynamicPrintConfig* print_cfg, const ArrangeParam
|
|||
// Slic3r.
|
||||
template<class PConf>
|
||||
void fill_config(PConf& pcfg, const ArrangeParams ¶ms) {
|
||||
|
||||
if (params.is_seq_print) {
|
||||
// Start placing the items from the center of the print bed
|
||||
pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT;
|
||||
}
|
||||
else {
|
||||
// Start placing the items from the center of the print bed
|
||||
pcfg.starting_point = PConf::Alignment::TOP_RIGHT;
|
||||
}
|
||||
|
||||
|
||||
if (params.is_seq_print) {
|
||||
// Start placing the items from the center of the print bed
|
||||
pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT;
|
||||
}
|
||||
else {
|
||||
// Start placing the items from the center of the print bed
|
||||
pcfg.starting_point = PConf::Alignment::TOP_RIGHT;
|
||||
}
|
||||
|
||||
if (params.do_final_align) {
|
||||
// Align the arranged pile into the center of the bin
|
||||
pcfg.alignment = PConf::Alignment::CENTER;
|
||||
|
|
@ -564,6 +564,14 @@ public:
|
|||
m_norm = std::sqrt(m_bin_area);
|
||||
fill_config(m_pconf, params);
|
||||
this->params = params;
|
||||
|
||||
// if best object center is not bed center, specify starting point here
|
||||
if (std::abs(this->params.align_center.x() - 0.5) > 0.001 || std::abs(this->params.align_center.y() - 0.5) > 0.001) {
|
||||
auto binbb = sl::boundingBox(m_bin);
|
||||
m_pconf.best_object_pos = binbb.minCorner() + Point{ binbb.width() * this->params.align_center.x(), binbb.height() * this->params.align_center.y() };
|
||||
m_pconf.alignment = PConfig::Alignment::USER_DEFINED;
|
||||
}
|
||||
|
||||
for (auto& region : m_pconf.m_excluded_regions) {
|
||||
Box bb = region.boundingBox();
|
||||
m_excluded_and_extruCali_regions.emplace_back(bb);
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ struct ArrangeParams {
|
|||
float clearance_height_to_lid = 0;
|
||||
float cleareance_radius = 0;
|
||||
float printable_height = 256.0;
|
||||
Vec2d align_center{ 0.5,0.5 };
|
||||
|
||||
ArrangePolygons excluded_regions; // regions cant't be used
|
||||
ArrangePolygons nonprefered_regions; // regions can be used but not prefered
|
||||
|
|
|
|||
|
|
@ -853,6 +853,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
|||
// BBS
|
||||
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode", "template_custom_gcode",
|
||||
"nozzle_type","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types","support_chamber_temp_control","support_air_filtration","printer_structure","thumbnail_size",
|
||||
"best_object_pos",
|
||||
//OrcaSlicer
|
||||
"host_type", "print_host", "printhost_apikey",
|
||||
"print_host_webui",
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ void PrintConfigDef::init_common_params()
|
|||
def->mode = comAdvanced;
|
||||
def->cli = ConfigOptionDef::nocli;
|
||||
def->set_default_value(new ConfigOptionEnum<AuthorizationType>(atKeyPassword));
|
||||
|
||||
|
||||
// temporary workaround for compatibility with older Slicer
|
||||
{
|
||||
def = this->add("preset_name", coString);
|
||||
|
|
@ -1761,6 +1761,12 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionEnum<PrinterStructure>(psUndefine));
|
||||
|
||||
def = this->add("best_object_pos", coPoint);
|
||||
def->label = L("Best object position");
|
||||
def->tooltip = L("Best auto arranging position in range [0,1] w.r.t. bed shape.");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionPoint(Vec2d(0.5, 0.5)));
|
||||
|
||||
def = this->add("auxiliary_fan", coBool);
|
||||
def->label = L("Auxiliary part cooling fan");
|
||||
def->tooltip = L("Enable this option if machine has auxiliary part cooling fan");
|
||||
|
|
|
|||
|
|
@ -956,6 +956,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionInts, fan_min_speed))
|
||||
((ConfigOptionFloats, min_layer_height))
|
||||
((ConfigOptionFloat, printable_height))
|
||||
((ConfigOptionPoint, best_object_pos))
|
||||
((ConfigOptionFloats, slow_down_min_speed))
|
||||
((ConfigOptionFloats, nozzle_diameter))
|
||||
((ConfigOptionBool, reduce_infill_retraction))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue