This commit is contained in:
bubnikv 2019-02-05 18:14:27 +01:00
commit 2a7e5bc0ae
12 changed files with 57 additions and 7 deletions

View File

@ -2566,6 +2566,14 @@ void PrintConfigDef::init_sla_params()
def->enum_labels.push_back(L("Dynamic"));
def->default_value = new ConfigOptionEnum<SLAPillarConnectionMode>(slapcmDynamic);
def = this->add("support_buildplate_only", coBool);
def->label = L("Support on build plate only");
def->category = L("Supports");
def->tooltip = L("Only create support if it lies on a build plate. Don't create support on a print.");
def->cli = "support-buildplate-only!";
def->mode = comSimple;
def->default_value = new ConfigOptionBool(false);
def = this->add("support_pillar_widening_factor", coFloat);
def->label = L("Pillar widening factor");
def->category = L("Supports");

View File

@ -976,6 +976,9 @@ public:
// How the pillars are bridged together
ConfigOptionEnum<SLAPillarConnectionMode> support_pillar_connection_mode;
// Generate only ground facing supports
ConfigOptionBool support_buildplate_only;
// TODO: unimplemented at the moment. This coefficient will have an impact
// when bridges and pillars are merged. The resulting pillar should be a bit
// thicker than the ones merging into it. How much thicker? I don't know
@ -1031,6 +1034,7 @@ protected:
OPT_PTR(support_head_width);
OPT_PTR(support_pillar_diameter);
OPT_PTR(support_pillar_connection_mode);
OPT_PTR(support_buildplate_only);
OPT_PTR(support_pillar_widening_factor);
OPT_PTR(support_base_diameter);
OPT_PTR(support_base_height);

View File

@ -427,6 +427,7 @@ ExPolygons concave_hull(const ExPolygons& polys, double max_dist_mm = 50,
return r;
});
// This is unavoidable...
punion = unify(punion);
return punion;
@ -448,10 +449,17 @@ void base_plate(const TriangleMesh &mesh, ExPolygons &output, float h,
slicer.slice(heights, &out, thrfn);
size_t count = 0; for(auto& o : out) count += o.size();
// Now we have to unify all slice layers which can be an expensive operation
// so we will try to simplify the polygons
ExPolygons tmp; tmp.reserve(count);
for(auto& o : out) for(auto& e : o) tmp.emplace_back(std::move(e));
for(ExPolygons& o : out) for(ExPolygon& e : o) {
auto&& exss = e.simplify(0.1/SCALING_FACTOR);
for(ExPolygon& ep : exss) tmp.emplace_back(std::move(ep));
}
ExPolygons utmp = unify(tmp);
for(auto& o : utmp) {
auto&& smp = o.simplify(0.1/SCALING_FACTOR);
output.insert(output.end(), smp.begin(), smp.end());

View File

@ -1898,6 +1898,17 @@ bool SLASupportTree::generate(const PointSet &points,
}
};
if(cfg.ground_facing_only) { // Delete the non-gnd steps if necessary
program[ROUTING_NONGROUND] = []() {
BOOST_LOG_TRIVIAL(info) << "Skipping non-ground facing supports as "
"requested.";
};
program[HEADLESS] = [](){
BOOST_LOG_TRIVIAL(info) << "Skipping headless stick generation as "
"requested";
};
}
Steps pc = BEGIN, pc_prev = BEGIN;
// Let's define a simple automaton that will run our program.

View File

@ -55,6 +55,9 @@ struct SupportConfig {
// How to connect pillars
PillarConnectionMode pillar_connection_mode = PillarConnectionMode::dynamic;
// Only generate pillars that can be routed to ground
bool ground_facing_only = false;
// TODO: unimplemented at the moment. This coefficient will have an impact
// when bridges and pillars are merged. The resulting pillar should be a bit
// thicker than the ones merging into it. How much thicker? I don't know

View File

@ -363,7 +363,11 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, const DynamicPrintConf
const_cast<PrintObjectStatus&>(*it_print_object_status).status = PrintObjectStatus::Reused;
} else {
auto print_object = new SLAPrintObject(this, &model_object);
// FIXME: this invalidates the transformed mesh in SLAPrintObject
// which is expensive to calculate (especially the raw_mesh() call)
print_object->set_trafo(sla_trafo(model_object));
print_object->set_instances(new_instances);
print_object->config_apply(config, true);
print_objects_new.emplace_back(print_object);
@ -415,6 +419,7 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) {
case slapcmDynamic:
scfg.pillar_connection_mode = sla::PillarConnectionMode::dynamic; break;
}
scfg.ground_facing_only = c.support_buildplate_only.getBool();
scfg.pillar_widening_factor = c.support_pillar_widening_factor.getFloat();
scfg.base_radius_mm = 0.5*c.support_base_diameter.getFloat();
scfg.base_height_mm = c.support_base_height.getFloat();
@ -620,8 +625,8 @@ void SLAPrint::process()
// repeated)
if(!po.m_supportdata || !po.m_supportdata->support_tree_ptr) {
BOOST_LOG_TRIVIAL(warning) << "Uninitialized support data at "
<< "pad creation.";
BOOST_LOG_TRIVIAL(error) << "Uninitialized support data at "
<< "pad creation.";
return;
}
@ -643,9 +648,11 @@ void SLAPrint::process()
// This call can get pretty time consuming
auto thrfn = [this](){ throw_if_canceled(); };
if(elevation < pad_h)
if(elevation < pad_h) {
// we have to count with the model geometry for the base plate
sla::base_plate(trmesh, bp, float(pad_h), float(lh),
thrfn);
}
pcfg.throw_on_cancel = thrfn;
po.m_supportdata->support_tree_ptr->add_pad(bp, pcfg);
@ -939,7 +946,7 @@ void SLAPrint::process()
};
// this would disable the rasterization step
// m_stepmask[slapsRasterize] = false;
// m_stepmask[slapsRasterize] = false;
double pstd = (100 - max_objstatus) / 100.0;
st = max_objstatus;
@ -1063,6 +1070,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|| opt_key == "support_head_width"
|| opt_key == "support_pillar_diameter"
|| opt_key == "support_pillar_connection_mode"
|| opt_key == "support_buildplate_only"
|| opt_key == "support_base_diameter"
|| opt_key == "support_base_height"
|| opt_key == "support_critical_angle"

View File

@ -131,6 +131,9 @@ int main(int argc, char **argv)
GUI::GUI_App *gui = new GUI::GUI_App();
GUI::GUI_App::SetInstance(gui);
gui->CallAfter([gui, &input_files, &cli_config, &extra_config, &print_config] {
if (! gui->initialized()) {
return;
}
#if 0
// Load the cummulative config over the currently active profiles.
//FIXME if multiple configs are loaded, only the last one will have an effect.

View File

@ -600,7 +600,8 @@ void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta) const
#if ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES
GLfloat max_anisotropy = 0.0f;
::glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);
if (glewIsSupported("GL_EXT_texture_filter_anisotropic"))
::glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);
#endif // ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES
std::string filename = tex_path + "_top.png";

View File

@ -197,7 +197,7 @@ bool GUI_App::OnInit()
mainframe->Show(true);
return true;
return m_initialized = true;
}
unsigned GUI_App::get_colour_approx_luma(const wxColour &colour)

View File

@ -71,6 +71,7 @@ static wxString dots("…", wxConvUTF8);
class GUI_App : public wxApp
{
bool m_initialized { false };
bool app_conf_exists{ false };
wxColour m_color_label_modified;
@ -90,6 +91,7 @@ class GUI_App : public wxApp
public:
bool OnInit() override;
bool initialized() const { return m_initialized; }
GUI_App();

View File

@ -414,6 +414,7 @@ const std::vector<std::string>& Preset::sla_print_options()
"support_head_width",
"support_pillar_diameter",
"support_pillar_connection_mode",
"support_buildplate_only",
"support_pillar_widening_factor",
"support_base_diameter",
"support_base_height",

View File

@ -3191,6 +3191,7 @@ void TabSLAPrint::build()
optgroup = page->new_optgroup(_(L("Support pillar")));
optgroup->append_single_option_line("support_pillar_diameter");
optgroup->append_single_option_line("support_pillar_connection_mode");
optgroup->append_single_option_line("support_buildplate_only");
optgroup->append_single_option_line("support_pillar_widening_factor");
optgroup->append_single_option_line("support_base_diameter");
optgroup->append_single_option_line("support_base_height");