LUA scripting: issue with visualizing slices in GUI

LUA scripting: issue with visualizing slices in GUI

quentin_schmidBRKQZ
Enthusiast Enthusiast
509 Views
1 Reply
Message 1 of 2

LUA scripting: issue with visualizing slices in GUI

quentin_schmidBRKQZ
Enthusiast
Enthusiast

Hi I am trying to use a script to automate slicing. inspired by the example script, I wanted to display the obtained slices in the GUI using :

 

system:setloggingtooglwindow(true);
if tray == nil then
system:log(' tray is nil!');
else
local root = tray.root;

for mesh_index = 0, root.meshcount - 1 do

local mesh = root:getmesh(mesh_index);
local luamesh = mesh.mesh;
local MeshName = mesh.name;
local matrix = mesh.matrix;
newMesh = luamesh:dupe();
local matrix = mesh.matrix;
newMesh:applymatrix(matrix);
local outbox = newMesh:calcoutbox();
local Layersize = 0.03;

local FromZ = outbox.minz;
local ToZ = outbox.maxz;
system:log('Upper BB limit is :' .. ToZ);
local CreateInMemory = true;
local filename = PATH .. MeshName .. tostring("_") .. tostring(mesh_index) .. '.sli';
slice = system:slicemesh(newMesh, Layersize, FromZ, ToZ, CreateInMemory);
system:addslicetotree(slice);
--(0: USF, 1: CLI, 2: SLI, 3: CLS, 4: SLC);
slice:savetofile(filename, 2, Layersize, FromZ, ToZ);

end;
end;

 

but I do not see anything, even though the slicing seem to work well when I open the file that I exported.

 

Thanks,

 

Quentin

0 Likes
Accepted solutions (1)
510 Views
1 Reply
Reply (1)
Message 2 of 2

steffen_anders_adsk
Autodesk Support
Autodesk Support
Accepted solution

Hello, @quentin_schmidBRKQZ,

 

Welcome to the Netfabb forum!

 

This is not possible as this would cross between scopes which the current Lua implementation does not allow.

 

For more details see this remark in the online help: https://help.autodesk.com/view/NETF/2025/ENU/?guid=NETF-LUA-LUA#api-scopes

As well as this thread where the same limitation was hit by another user: https://forums.autodesk.com/t5/netfabb-forum/script10-slicebuildplatform/m-p/11709664#M2405

 

Kind regards,

Steffen

Steffen Anders
Autodesk Netfabb team

Netfabb resources: Online help • System requirements • Knowledge base • Forums • Homepage • YouTube

How to get Netfabb Basic: Video • Help • Download

0 Likes