... | @@ -914,6 +914,51 @@ Our `generateInfill` function queries the necessary printing settings and then l |
... | @@ -914,6 +914,51 @@ Our `generateInfill` function queries the necessary printing settings and then l |
|
|
|
|
|
#### `SamplePostProcessingPlugin`
|
|
#### `SamplePostProcessingPlugin`
|
|
|
|
|
|
|
|
For our sample post-processing plugin we allow the user to change the deposition flow for the perimeters of the print specifically, something that isn't possible currently in IceSL.
|
|
|
|
|
|
|
|
```c++
|
|
|
|
bool SamplePostProcessingPlugin::addPluginSettings(IceSLInterface::EnumerableSettingsInterface& enumerable_settings)
|
|
|
|
{
|
|
|
|
auto s = enumerable_settings.addSettingFromPlugin(
|
|
|
|
// Value storage, minimum and maximum value
|
|
|
|
&m_FlowMultiplierPerimeter, &m_FlowMultiplierPerimeter_min, &m_FlowMultiplierPerimeter,
|
|
|
|
// Internal name, UI name and Group
|
|
|
|
"flow_multiplier_perimeter", "Flow multiplier (perimeters)", "Processing",
|
|
|
|
"Specifies a flow multiplier that only applies for perimeters.", // Tooltip
|
|
|
|
1000, // Rank
|
|
|
|
// Show only when plugin is selected
|
|
|
|
[this, &enumerable_settings]() -> bool {
|
|
|
|
bool plugin_activated;
|
|
|
|
enumerable_settings.getSettingByName(m_InternalName)->getValue(plugin_activated);
|
|
|
|
return plugin_activated;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
return s != nullptr;
|
|
|
|
```
|
|
|
|
|
|
|
|
We start by adding a _Perimeter Flow_ setting to IceSL's UI that is only visible/modifiable when the plugin is selected.
|
|
|
|
|
|
|
|
```c++
|
|
|
|
bool SamplePostProcessing::postProcessLayer(const int, const int, const bool, const v2i&, std::vector<std::shared_ptr<IceSLInterface::IPath>>& _layer)
|
|
|
|
{
|
|
|
|
// Go through layer
|
|
|
|
for (size_t i = 0; i < _layer.size(); i++) {
|
|
|
|
if (_layer[i]->getPathType() & PathType::e_Perimeter) { // Post-process only perimeters
|
|
|
|
// Clone path (IceSL created paths can't be modified)
|
|
|
|
std::shared_ptr<IceSLInterface::IPath> path(new IceSLInterface::Path(*_layer[i]));
|
|
|
|
// Get the flow multiplier index
|
|
|
|
int attr_idx = path->getPathAttributeIndex("flow_multiplier");
|
|
|
|
if (attr_idx < 0) {
|
|
|
|
return false; // Flow multiplier should exist!
|
|
|
|
}
|
|
|
|
path->setPathAttributeValue(attr_idx, m_flow_multiplier_perimeter); // Set new flow
|
|
|
|
_layer[i] = path; // Replace obsolete IceSL path with out new perimeter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true; // Success!
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
The function `postProcessLayer` goes through the whole layer specifically discerning perimeters. On each perimeter, its flow is changed with the one set by the user in the printing parameter added by the plugin.
|
|
|
|
|
|
#### `SampleMachineCodePlugin` |
|
#### `SampleMachineCodePlugin` |
|
|
|
\ No newline at end of file |