Slicebuilder
The Slicebuilder object facilitates assembling a Slice object (a slice stack) from Slicelayer objects.
Properties
Property | Read/write | Type | Description |
---|---|---|---|
layercount | Read | Number | Count of layers to reserve for generating the Slice object |
layersize | Read | Number | Layer thickness in millimeters |
minz | Read | Number | Distance between global build platform and the first layer in millimeters |
Methods
Method | Syntax | Description |
---|---|---|
addlayer | slicebuilder:addlayer(Layer:Int,Slicelayer:Object) | Inserts the Slicelayer object's data into the Slicebuilder object at layer index of Layer starting with 0. Caution: In Netfabb, the first layer in a stack sits at minz , and a slice layer's "volume" is formed by projecting the layer's contours downwards. By convention, the first layer (with a Layer index of 0) should therefore be left empty, and the first non-empty layer should be the second layer in a stack (with a Layer index of 1) at the earliest. |
createslice | slice = slicebuilder:createslice() | Finalizes a Slicebuilder object into a Slice object (a slice stack) |
release | slicebuilder:release() | Clears the object and releases memory |
Example
Create two contours in a Slicelayer object, add it to a Slicebuilder object, then generate a Slice object and add it as a stack to the project tree.
To run this snippet, slice a dummy part and select the slice stack in the project tree to get access to the Run Lua script command. The dummy slice stack is not used in any other way.
myslicebuilder=system:createslicebuilder(5,1,0)
myslicelayer=system:createemptylayer()
myslicelayer:begincontour()
-- clockwise open contour
myslicelayer:addpoint(10,10)
myslicelayer:addpoint(5,15)
myslicelayer:addpoint(10,20)
myslicelayer:addpoint(15,15)
myslicelayer:begincontour()
-- counter-clockwise closed contour
myslicelayer:addpoint(30,10)
myslicelayer:addpoint(35,15)
myslicelayer:addpoint(30,20)
myslicelayer:addpoint(25,15)
myslicelayer:endcontour() -- closes the contour without needing to remember the coordinates for the first point in this contour
myslicebuilder:addlayer(1, myslicelayer)
mybuiltslice = myslicebuilder:createslice()
myslicebuilder:release()
system:addslicetotree(mybuiltslice)