Share

Script8_CreateSupport.lua

-- Lua example for Autodesk Netfabb 2019.1

-- Generates supports for all parts present as needed

-- Requires a support script as a file

local insertMeshesIntoTable
insertMeshesIntoTable = function (meshgroup, Outtable)
    for mesh_index = 0, meshgroup.meshcount - 1 do  
        local traymesh = meshgroup:getmesh(mesh_index)
        table.insert(Outtable, traymesh)
    end
    for group_index = 0, meshgroup.groupcount - 1 do  
        subgroup = meshgroup:getsubgroup(group_index)
        insertMeshesIntoTable(subgroup, Outtable)
    end
end


system:setloggingtooglwindow(true)
root = tray.root
-- Collect meshes in the tray
meshes = {}
insertMeshesIntoTable(root, meshes)

-- Iterate meshes in group
for i, traymesh in pairs(meshes) do
    local luamesh = traymesh.mesh
    local matrix = traymesh.matrix
    newMesh = luamesh:dupe()
    newMesh:applymatrix(matrix)
    support = newMesh:createsupport('Examples\\LUA Scripts\\dlp.support')
    traymesh:assignsupport(support, false)
end

Was this information helpful?