ScriScript10_SliceBuildPlatform.lua
-- Lua example for Autodesk Netfabb 2019.0
-- Slices all parts on the current tray and writes the slice files to the file system
system:setloggingtooglwindow(true)
root = tray.root
for mesh_index = 0, root.meshcount - 1 do
local mesh = root:getmesh(mesh_index)
local luamesh = mesh.mesh
local matrix = mesh.matrix
newMesh = luamesh:dupe()
local matrix = mesh.matrix
newMesh:applymatrix(matrix)
local boundingbox = newMesh:calcoutbox()
local layersize = 1
local fromZ = boundingbox.minz
local toZ = boundingbox.maxz
local createInMemory = true
slice = system:slicemesh(newMesh, layersize, fromZ, toZ, createInMemory)
local filename = "mesh" .. tostring(mesh_index) .. ".sli"
--(0: USF, 1: CLI, 2: SLI, 3: CLS, 4: SLC);
slice:savetofile(filename, 2, layersize, fromZ, toZ)
end