... | ... | @@ -495,4 +495,115 @@ Intuitively, IceSL preemptively calls 'startWriting' before proceeding with 'ste |
|
|
|
|
|
### Interface Structures <a name="structures"></a>
|
|
|
|
|
|
IceSL elies on data structures to pass information to plugins about deposition trajectories and sliced layers. There are three classes; `IPath`, `ILayer` and `ILayerSe`. |
|
|
\ No newline at end of file |
|
|
IceSL elies on data structures to pass information to plugins about deposition trajectories and sliced layers. There are three classes; `IPath`, `ILayer` and `ILayerSet`.
|
|
|
|
|
|
```c++
|
|
|
namespace IceSLInterface
|
|
|
{
|
|
|
class IPath
|
|
|
{
|
|
|
public:
|
|
|
|
|
|
IPath() = default;
|
|
|
virtual ~IPath() = default;
|
|
|
|
|
|
// Returns 'true' if the path is cyclic (first point == last point).
|
|
|
virtual bool isCyclic() const = 0;
|
|
|
|
|
|
// Returns 'true' if the path comes from a plugin.
|
|
|
virtual bool isCustom() const = 0;
|
|
|
|
|
|
// Queries the extruder used for this path.
|
|
|
virtual int getTool() const = 0;
|
|
|
|
|
|
// Sets the extruder used for this path.
|
|
|
virtual void setTool(int t) = 0;
|
|
|
|
|
|
// Returns the path type bitfield. The output of this function is enumerated in file
|
|
|
// 'PathTypeBitField.h'
|
|
|
virtual uint getPathType() const = 0;
|
|
|
|
|
|
// Sets the path type bitfield for this path.
|
|
|
virtual void setPathType(uint) = 0;
|
|
|
|
|
|
// Initializes a path based on a trajectory. Must be called before any per-vertex
|
|
|
// operation is performed.
|
|
|
virtual void createPath(
|
|
|
const ClipperLib::Path &path, // Path trajectory (vertices)
|
|
|
bool cyclic // 'true' = open path, 'false' = closed path
|
|
|
) = 0;
|
|
|
|
|
|
// Adds an attribute to this path. Returns the attribute's index.
|
|
|
virtual int addPathAttribute(
|
|
|
const std::string& pathAttribute // Path attribute name
|
|
|
) = 0;
|
|
|
|
|
|
// Adds a per-vertex attribute to this path. Returns the new attribute index.
|
|
|
virtual int addPerVertexAttribute(
|
|
|
const std::string& vertexAttribute // Vertex attribute name
|
|
|
) = 0;
|
|
|
|
|
|
// Returns the number of vertices in the path (i.e., trajectory points).
|
|
|
virtual int getNumVertices() const = 0;
|
|
|
|
|
|
// Returns the position of the i-th vertex (i.e., trajectory point) from this path.
|
|
|
virtual ClipperLib::IntPoint getVertexPos(int) const = 0;
|
|
|
|
|
|
// Gets all path attributes' names.
|
|
|
virtual void getPathAttributes(
|
|
|
std::vector<std::string>& _pathAttributes // Path attributes' names
|
|
|
) const = 0;
|
|
|
|
|
|
// Returns the index of the path attributes, -1 if unknown.
|
|
|
virtual int getPathAttributeIndex(
|
|
|
const std::string& pathAttribute // Path attribute's name
|
|
|
) const = 0;
|
|
|
|
|
|
// Gets the value of the path attribute.
|
|
|
virtual void getPathAttributeValue(
|
|
|
int pathAttribute, // Path attribute index
|
|
|
double& pathAttributeValue // Path attribute value
|
|
|
) const = 0;
|
|
|
|
|
|
// Sets the value of the path attribute.
|
|
|
virtual void setPathAttributeValue(
|
|
|
int pathAttribute, // Path attribute index
|
|
|
double pathAttributeValue // Path attribute value
|
|
|
) = 0;
|
|
|
|
|
|
// Gets all per-vertex attributes' names.
|
|
|
virtual void getPerVertexAttributes(
|
|
|
std::vector<std::string>& _vertexAttributes // Per-vertex attributes' names
|
|
|
) const = 0;
|
|
|
|
|
|
// Returns the index of the per-vertex attribute, -1 if unknown.
|
|
|
virtual int getPerVertexAttributeIndex(
|
|
|
const std::string& vertexAtttribute // Per-vertex attribute's name
|
|
|
) const = 0;
|
|
|
|
|
|
// Gets the value of the per-vertex attribute for the i-th vertex.
|
|
|
virtual void getPerVertexAttributeValue(
|
|
|
int vertexAttribute, // Per-vertex attribute index
|
|
|
int vertexIndex, // Vertex index
|
|
|
double& vertexAttributeValue // Per-vertex attribute value
|
|
|
) const = 0;
|
|
|
|
|
|
// Sets the value of the per-vertex attribute for the i-th vertex.
|
|
|
virtual void setPerVertexAttributeValue(
|
|
|
int vertexAttribute, // Per-vertex attribute index
|
|
|
int vertexIndex, // Vertex index
|
|
|
double vertexAttributeValue // Per-vertex attribute value
|
|
|
) = 0;
|
|
|
};
|
|
|
}
|
|
|
```
|
|
|
|
|
|
Paths created by IceSL (e.g., when producing Machine Code) support the following attributes:
|
|
|
- Path attributes:
|
|
|
* `"flow_multiplier"`
|
|
|
* `"speed_multiplier"`
|
|
|
- Vertex attributes:
|
|
|
* `"flow_multiplier"`
|
|
|
* `"zoffset"`
|
|
|
|
|
|
As 'IPath' is a pure virtual class, it is sometimes necessary to have an implementation of it when creating a path. For this purpose, the plugin interface provides the class 'Path'. |
|
|
\ No newline at end of file |