Ported a couple more methods to XS

This commit is contained in:
Alessandro Ranellucci 2015-12-02 18:29:33 +01:00
parent ed75219215
commit 3a9cf91f83
8 changed files with 33 additions and 27 deletions

View file

@ -824,6 +824,24 @@ Print::has_support_material() const
return false;
}
/* This method assigns extruders to the volumes having a material
but not having extruders set in the volume config. */
void
Print::auto_assign_extruders(ModelObject* model_object) const
{
// only assign extruders if object has more than one volume
if (model_object->volumes.size() < 2) return;
size_t extruders = this->config.nozzle_diameter.values.size();
for (ModelVolumePtrs::const_iterator v = model_object->volumes.begin(); v != model_object->volumes.end(); ++v) {
if (!(*v)->material_id().empty()) {
size_t extruder_id = (v - model_object->volumes.begin()) + 1;
if (!(*v)->config.has("extruder"))
(*v)->config.opt<ConfigOptionInt>("extruder", true)->value = extruder_id;
}
}
}
#ifdef SLIC3RXS
REGISTER_CLASS(Print, "Print");