... | ... | @@ -7,12 +7,13 @@ This is the official documentation of the IceSL plugin system. In here you will |
|
|
2. [Setting Up the Framework](#framework)
|
|
|
|
|
|
3. [Interface Specification](#specification)
|
|
|
1. [Settings interface](#settings)
|
|
|
1. [Settings Interface](#settings)
|
|
|
2. [Infill Plugin](#infill)
|
|
|
3. [Post-processing Plugin](#post-processing)
|
|
|
4. [Machine Code Plugin](#machinecode)
|
|
|
|
|
|
4. [Creating Your Own Plugin](#creating)
|
|
|
1. [The Shared Library Interface]
|
|
|
1. [EEE; Examples Explained Explicitly](#examples)
|
|
|
|
|
|
## The Plugin System <a name="general"></a>
|
... | ... | @@ -68,7 +69,7 @@ Make sure you're using the latest interface as well as the latest version of Ice |
|
|
|
|
|
The plugin interface uses the namespace `IceSLInterface` and the base class for all plugins is `IPlugin`. A plugin **must not** derive from `IPlugin` under any circumstance. Appropriate derived classes for each type of plugin are provided and discussed further down.
|
|
|
|
|
|
The interface of `IPlugin` is the following:
|
|
|
We now expose the class `IPlugin` and the interface to manage (i.e., query or add) printing settings.
|
|
|
|
|
|
```c++
|
|
|
namespace IceSLInterface
|
... | ... | @@ -112,6 +113,8 @@ public: |
|
|
```
|
|
|
|
|
|
```c++
|
|
|
namespace IceSLInterface
|
|
|
{
|
|
|
class IPluginEnvironment
|
|
|
{
|
|
|
public:
|
... | ... | @@ -123,6 +126,7 @@ public: |
|
|
void setImGuiContext(ImGuiContext* ctx);
|
|
|
ImGuiContext* getImGuiContext() const;
|
|
|
};
|
|
|
}
|
|
|
```
|
|
|
|
|
|
### Settings Interface <a name="settings"></a>
|
... | ... | @@ -130,6 +134,8 @@ public: |
|
|
The interface of `EnumerableSettingsInterface` is the following:
|
|
|
|
|
|
```c++
|
|
|
namespace IceSLInterface
|
|
|
{
|
|
|
class EnumerableSettingsInterface
|
|
|
{
|
|
|
public:
|
... | ... | @@ -269,4 +275,90 @@ Finally, to query or add a printing parameter, the interface is as follows: |
|
|
// Gets the number of available brushes and printing extruders respectively.
|
|
|
virtual int getNumberOfBrushes() const;
|
|
|
virtual int getNumberOfExtruders() const;
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
};
|
|
|
}
|
|
|
```
|
|
|
|
|
|
What follows are the interfaces of each type of plugin (infill, post-processing and machine code). Each one has a separate _interface_ class for specific functions that are called by IceSL according to its function (e.g., an infill plugin must implement a function infilling a layer).
|
|
|
|
|
|
### Infill Plugin <a name="infill"></a>
|
|
|
|
|
|
An infill plugin implements infill patterns that are applied for each resulting printing layer. Derive from class `IInfillerPlugin` when creating one.
|
|
|
|
|
|
```c++
|
|
|
namespace IceSLInterface
|
|
|
{
|
|
|
class IInfillerPlugin : public IPlugin
|
|
|
{
|
|
|
public:
|
|
|
|
|
|
IInfillerPlugin() = default;
|
|
|
~IInfillerPlugin() override = default;
|
|
|
|
|
|
// Creates and returns an Infiller Interface
|
|
|
virtual std::unique_ptr<IInfillerInterface> createInfiller() = 0;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
The infiller interface is specified in class `IInfillerInterface`. All its functions must be implemented as they will be called by IceSL. Some of them serve the purpose of passing properties of the geometry to be printed to the plugin itself (e.g., `setNumSlices`).
|
|
|
|
|
|
```c++
|
|
|
namespace IceSLInterface
|
|
|
{
|
|
|
class IInfillerInterface
|
|
|
{
|
|
|
public:
|
|
|
IInfillerInterface() = default;
|
|
|
virtual ~IInfillerInterface() = default;
|
|
|
|
|
|
// Sets the printing settings interface.
|
|
|
void setSettings(const EnumerableSettingsInterface *settings) { m_EnumerableSettings = settings; }
|
|
|
|
|
|
// Sets the total number of slices, before any infill is generated.
|
|
|
virtual void setNumSlices(int num) = 0;
|
|
|
|
|
|
// Sets the world space position and dimension, before any infill is generated.
|
|
|
// This allows to go from build space to world space, for instance to query
|
|
|
// per-layer or field parameters.
|
|
|
virtual void setWorldSpace(v3f world_corner_mm, v3f extent_mm) = 0;
|
|
|
|
|
|
// Called when the infill plugin is about to be used for a brush, prior to infill generation.
|
|
|
virtual void prepareInfill(int brush) = 0;
|
|
|
|
|
|
// Called after the infill for a given brush has been generated.
|
|
|
virtual void terminateInfill(int brush) = 0;
|
|
|
|
|
|
// Called just before the path generation for a given layer
|
|
|
virtual void prepareInfillForSlice(
|
|
|
int id, // Layer number (0 means lowest layer)
|
|
|
const AAB<2, int> &xy_slice_box, // Layer position and dimension in world space
|
|
|
float layer_height_mm, // Layer height in millimeters w.r.t. bed level
|
|
|
double layer_thickness_mm, // Layer thickness in millimeters
|
|
|
int brush // Brush of geometry to be infilled
|
|
|
) = 0;
|
|
|
|
|
|
// Called on each surface within a layer. Returns 'true' if an infill was produced, 'false' to
|
|
|
// default to IceSL's built-in infiller.
|
|
|
virtual bool generateInfill(
|
|
|
int id, // Layer number (0 means lowest layer)
|
|
|
float layer_height_mm, // Layer height in millimeters w.r.t. bed level
|
|
|
double layer_thickness_mm, // Layer thickness in millimeters
|
|
|
int brush, // Brush of geometry to be infilled
|
|
|
const ClipperLib::Paths &surface, // Surface to infill
|
|
|
std::vector<std::unique_ptr<IPath> > &fills, // Set this to the generated infill
|
|
|
bool &preserve_order, // Set to 'true' to preserve order of generated paths (defaults to false)
|
|
|
ClipperLib::Paths &_fallback_surface // Unfilled surfaces to be handled by IceSL (can be empty)
|
|
|
) = 0;
|
|
|
|
|
|
protected:
|
|
|
|
|
|
// Use this interface to access or add printing settings as well as query
|
|
|
// the number of brushes or extruders (where applicable)
|
|
|
const EnumerableSettingsInterface* m_EnumerableSettings;
|
|
|
};
|
|
|
}
|
|
|
```
|
|
|
|
|
|
### Post-processing Plugin <a name="post-processing"></a>
|
|
|
|
|
|
### Machine Code Plugin <a name="machinecode"></a> |
|
|
\ No newline at end of file |