About Lua in Netfabb

Applies to 2021.1 Update and later

Jump to:

Introduction

Lua is Netfabb's method of choice to facilitate automation tasks inside the software, available in Netfabb Ultimate. One particular advantage is that, while not necessary, a Lua script may work on an entirely different project than currently loaded in Netfabb, if any.

Lua-automatable areas in Netfabb

  1. Part operations on platforms, including machines
  2. Slicing
  3. Selective Space Structures (3S)

For the Lua reference on 3S, see the relevant section in Latticing.

Top

Supported Lua scope

Netfabb supports generally the version 5.1 of the Lua language definition, see: http://www.lua.org/manual/5.1/

Of the Lua 5.1 standard, Netfabb supports the core language specification as well as selected libraries.

Lua Library

Support

Note

Base

Yes, with exceptions

Some exceptions:
  • dofile: use system:executescriptfile() instead
  • print: use system:log() instead. Remember to first set where the logging should go, with system:logtofile("c:\lualog.txt"); for example; otherwise the only place to follow logging output is the debugger.

Coroutine Manipulation

Yes

Modules

No

Use system:executescriptfile()

String manipulation

Yes

Table manipulation

Yes

Mathematical Functions

Yes

Input and output Facilities

No

Operating System Facilities

No

Debug library

No

For Lua in the Netfabb default module, also referred to as desktop automation, a debugger GUI is available.

Top

Scripting reference

The scripting reference lists all available objects, methods, and properties available in Netfabb's Lua implementation. It has its own section in the online help.

Top

Lua script library

To make Lua scripts available for execution within Netfabb they are stored in a library, that means loading them from files and storing them internally. The library resides in Netfabb's settings database. The library provides several functions:

Top

Script examples

Netfabb includes a number of example scripts that demonstrate how to address a variety of tasks with Lua. These can be found in the library as well as at Examples\LUA Scripts in the Netfabb installation directory. Some of them require some modification like changing paths to meet your particular installation and paths.

Noteworthy examples are the scripts DemoApplication and DemoWorkflows. Both are full applications written in Lua and run within Netfabb. They implement a selection from the example scripts and make them available via GUI to demonstrate not only the use of such scripts but also how to implement a GUI to collate such functions. They are two of the default scripts loaded in the library.

Top