Script Module Command Reference

The following methods and properties are available for the Netfabb script module. Read only properties are often used as part of conditions or calculations, but do not directly perform any function.

LUAStructure

Commands for the LUAStructure class. They apply for the whole structure.

Functions:

Name Parameters Result Use Example Effect
log string message, [number progress] - Insert the message displayed during calculations triggered by the script. structure:log("Part finished"); At the respective stage of the execution of the script, "Part finished" is displayed.
getvolumedata number index LUA Volume Data A set of volume data of your structure is loaded into the script. The number index represents the count of the volume data in the 3S Generator, starting the count with 0. volumedata=structure: getvolumedata(0); The first set of volume data of the structure is from now on referred to as "volumedata" in the script.
findvolumedata string name LUA Volume Data As above, only without a number, but with insertion of the name of the volume data. volumedata=structure:findvolumedata("volume1"); The set of volume data with the name "volume1" in the 3S Generator is from now on referred to as "volumedata" in the script.
getcell number index LUA Base Cell Loads a structure cell into the script. The number index represents the count of the cell in the structure, starting with 0. cell=structure:getcell(0) The first cell of the structure in the 3S Generator is from now on referred to as "cell" in the script.
findcell string name LUA Base Cell As above, only without a number, but with insertion of the name of the cell. cell=structure:findcell("cell"); The cell with the name "cell 1" in the 3S Generator is from now on referred to as "cell" in the script.
executescript string name - Executes another script as part of current script. structure:executescript("script1"); "script1" is executed during execution of current script.

Properties:

Name Parameters Result Use Example Effect
volumedatacount number read only Reads the count of volume data sets in the 3S Executor.

if

volume.volumedatacount(2)

Condition: if there are two sets of volume data.
cellcount number read only Reads the count of structure cells

if

cell.cellcount(2)

Condition: if there are two cells.
simulateafterexecution boolean read and write After the script is executed in the 3S Executor, a simulation of the structure is automatically created. structure.simulateafterexecution=true; Executes the function "Create Simulation".

LUAVolumeData

Commands for the LUAVolume class. They refer to volume data in the script and therefore apply for the volume data in your 3S Executor.

Functions:

Name Parameters Result Use Example Effect
reset - - All operations conducted with the volume data are undone. volumedata:reset(); The function "Reset Fragmentation" of the 3S Executor is performed.
cleanup - - Removes all empty fragments volumedata:cleanup(); All fragments which no longer contain any grid cells are deleted.
getfragment number index LUA Volume Data Fragment Loads a fragment of your volume data into the script. The number index represents the count of the fragment in the volume data, starting with 0. fragment=volumedata:getfragment(0); The first fragment of "volumedata" in the 3S Executor is from now on referred to as "fragment" in the script.
findfragment string name LUA Volume Data Fragment As above, only without a number, but with insertion of the name of the fragment. fragment=volumedata:findfragment("fragment1"); The fragment with the name "fragment1" in "volumedata" in the 3S Executor is from now on referred to as "fragment" in the script.
getgroup number index LUA Volume Data Group Loads a volume group of your volume data into the script. The number index represents the count of the volume group in the volume data, starting with 0. group=volumedata:getgroup(0); The first volume group or subgroup in "volume-data" in the 3S Executor is from now on referred to as "group" in the script.
findgroup string name LUA Volume Data Group As above, only without a number, but with insertion of the name of the volume group. group=volumedata:findgroup("group1"); The volume group or subgroup with the name "group1" in "volumedata" in the 3S Executor is from now on referred to as "group" in the script.
addgroup string name LUA Volume Data Group Adds a new subgroup to the structure in the 3S Executor. group=volumedata:addgroup("group1"); A new subgroup referred to as "group" in the script is added to the part.
addmeshtoraster - LUA Volume Data Fragment Your part is rasterized and a basic fragment is inserted. volumedata:addmeshtoraster(); The function "Grid Part" of the 3S Executor is performed.
resize

number plusx,

number plusy,

number plusz,

number minusx,

number minusy,

number minusz,

- The grid is enlarged by the number of grid cells you specify in the parameters. This has no effect on existing fragments. volumedata:resize(1,1,1,2,2,2); Executes the function "Enlarge Grid" with an expansion of Plus 1 and Minus 2 along all three axes.
merge

object fragment1/group1, [object fragment2/group2], [object fragment3/group3], [object fragment4/group4], [object fragment5/group5], [object fragment6/group6],

LUA Volume Data Fragment The fragments or groups specified in the parameters are merged and become one fragment. part=volumedata:merge(fragment1,fragment2); fragment1 and fragment2 are merged as with the function "Merge" and will be referred to as "part" in the script.

Properties:

Name Parameters Result Use Example Effect
name string read only Reads the name of the volume data. volumedata.name;
visible boolean read and write Makes the volume data visible or invisible in the structure tree of the 3S Executor. volumedata.visible=false; "volumedata" is not visible, as if the "Visible for user" check box in the volume data tabsheet of the 3S Generator is disabled.
rastersizex number read only Grid cell size in mm along X-axis. volumedata.rastersizex
rastersizey number read only Grid cell size in mm along Y-axis. volumedata.rastersizey
rastersizez number read only Grid cell size in mm along Z-axis. volumedata.rastersizez
sizex number read only Number of grid cells along X-axis. volumedata.sizex
sizey number read only Number of grid cells along Y-axis. volumedata.sizey
sizez number read only Number of grid cells along Z-axis. volumedata.sizez
originx number read only Origin of grid in platform along X-axis. volumedata.originx
originy number read only Origin of grid in platform along Y-axis. volumedata.originy
originz number read only Origin of grid in platform along Z-axis. volumedata.originz
fragmentcount number read only Number of fragments in the volumedata. volumedata.fragmentcount
groupcount number read only Number of volume groups and subgroups in the volume data. volumedata.groupcount

LUAVolumeDataFragment

Commands for the LUAVolumeDataFragment class. Referring to fragment in the script, they conduct fragmentation operations, including the volume tools of the 3S Executor.

Functions:

Name Parameters Result Use Example Effect
movetogroup object group boolean Fragments can be moved into Volume groups. fragment:movetogroup(gr1) "fragment" is moved into the Volume Group "gr1".
generatechessboard [number blocksizex], [number blocksizey], [number blocksizez], [number translationx], [number translationy], [number translationz] LUA Volume Data Fragment Cuts a new fragment in shape of a three-dimensional chessboard out of another fragment. The parameters are the same as in the respective function. fragment1=fragment:generatechessboard(2,1,3,0,0,0); Executes function "Create Chessboard" with blocksize X=2, Y=1, Z=3 and no translations. The chessboard fragment is referred to as "fragment1" in the script and is cut out of "fragment".
createhull [number minusx], [number minusy], [number minusz], [number plusx], [number plusy], [number plusz] LUA Volume Data Fragment As in the equivalent function, a fragment is split into a core and an outer hull or outer walls. hull=fragment:createhull(1,0,0,2,0,0); A fragment referred to as "hull" in the script is split off from "fragment" with the thickness Minux X=1, Plus X=2.
divideblocks [number blocksizex], [number blocksizey], [number blocksizez], [number translationx], [number translationy], [number translationz], [boolean fillblocks] LUA Volume Data Fragment Calculates the insertion of same-sized blocks into a fragment. The size of these blocks is defined by the parameters. Grid cells not fitting into blocks of this size are split off. The option "Fill incomplete blocks" can be activated by adding "true" as the last parameter. blocks=fragments:divideblocks(4,4,4,0,0,0); Executes the function "Split off blocks" with the blocksize X=4, Y=4, Z=4 and no translations. The new fragment including the blocks will be referred to as "blocks" in the script. The option "Fill incomplete blocks" is not activated.
createprojection [number type], [boolean celloverride] LUA Volume Data Fragment Adds a new fragment with new grid cells. They fill up the space between existing grid cells and the end of the grid. The direction can be specified with the parameters. The option "Overwrite grid cells of other fragments" can be activated by adding "true" as the last parameter. fragment1=fragment:createprojection(1);

projection(number) 1 = +x, 2 = -x, 3 = +y, 4 = -y, 5 = +z, 6 = -z

Executes the function "Projection" of "fragment" in the Plus X-direction. The projection fragment will be referred to as "fragment1" in the script. The option "Overwrite grid cells of other fragments" is deactivated.
createexpansion [number minusx], [number minusy], [number minusz], [number plusx], [number plusy], [number plusz], [boolean celloverride] LUA Volume Data Fragment Adds a fragment with additional grid cells forming outer walls of the original fragment. The parameters determine the number of added grid cells in each direction. The option "Overwrite grid cells of other fragments" can be activated by adding "true" as the last parameter. fragment1=fragment:createexpansion(0,0,0,1,2,0); Executes the function "Expansion" with "fragment", with one grid cell added in Plus X direction and two grid cells in Minus Y direction. The new fragment is referred to as "fragment1" in the script. The option "Overwrite grid cells of other fragments" is deactivated.
randomize [number blocksizex], [number blocksizey], [number blocksizez], [number translationx], [number translationy], [number translationz], [number probability] LUA Volume Data Fragment Calculates blocks with a blocksize determined in the parameters. Randomly assigns a defined percentage of blocks to the new fragment. randomfrag=fragment:randomize(1,1,2,0,0,0,30) Executes the function "Randomize" with a blocksize X=1, Y=1, Z=1, no translations and a threshold of 30%. The new fragment is referred to as "randomfrag" in the script.
splitbyenvironment [number minusx], [number minusy], [number minusz], [number plusx], [number plusy], [number plusz] LUA Volume Data Fragment Splits off grid cells from a fragment, depending on the number of neighboring grid cells. The numbers and direction are specified in the parameters. It does not matter if the neighboring grid cells belong to the same fragment. environfrag=fragment:splitbyenvironment(2,0,2,2,0,2) Executes the function "Split by Environment", based on "fragment". The specifications are Minus X=2, Minus Y=0, Minus Z=2, Plus X=2, Plus Y=0, Plus Z=0. The central fragment will be referred to as "environfrag" in the script.
splitintoshells - LUA Volume Data Fragment Fragment is split apart so that only connected grid cells belong to the same fragment. If a fragment consists of two cohesive components, they will both become an own fragment. fraggroup=fragment:splitintoshells Executes the function "Split into connected fragments."
remove - - Deletes a fragment. fragment:remove(); "fragment" is removed from the grid.

Properties:

Name Parameters Result Use Example Effect
name string read and write Reads name or changes the name of objects in the 3S Executor. In the script, it will still be referred to as before. fragment.name="Base fragment"; "fragment" is named "Base fragment" in the 3S Executor.
color number read and write Changes the color of fragments. fragment.color=49906; "fragment" gets color 49906.
rastercount number read only fragment.rastercount;
cell object read and write Reads cell of fragment or assigns a cell to a fragment. fragment.cell=cell1; "cell1" is assigned to "fragment".

LUAVolumeDataGroup

Commands for the LUAVolumeDataGroup class refer to groups of volume data sets in the script and modify Volume groups in the 3S Executor.

Functions:

Name Parameters Result Use Example Effect
movetogroup object group boolean Subgroups can be moved into Volume groups or other subgroups. group1:movetogroup(group2); "group1" is moved into the Volume Group "group2".
getfragment number index LUA Volume Data Fragment Loads a fragment of a group into the script. The number index represents the count of the fragment in the group, starting with 0. fragment=group1:getfragment(0); The first fragment of "group1" in the 3S Executor is from now on referred to as "fragment" in the script.
findfragment string name LUA Volume Data Fragment As above, only without a number, but with insertion of the name of the fragment. fragment=group1:findfragment("fragment1"); The fragment with the name "fragment1" in "group1" in the 3S Executor is from now on referred to as "fragment" in the script.
getgroup number index LUA Volume Data Group Loads a subgroup of your group into the script. The number index represents the count of subgroups in the group, starting with 0. newgroup=group1:getgroup(0); The first subgroup of "group1" in the 3S Executor is from now on referred to as "newgroup" in the script.
findgroup string name LUA Volume Data Group As above, only without a number, but with insertion of the name of the group. newgroup=group1:findgroup("group2"); The subgroup with the name "group2" in "group1" in the 3S Executor is from now on referred to as "newgroup" in the script.
addgroup string name LUA Volume Data Group Adds a new subgroup to the group in the 3S Executor. group=group1:addgroup("group1"); A new subgroup referred to as "group" in the script is added to "group1".

Properties:

Name Parameters Result Use Example Effect
name string read and write Reads name or changes the name of objects in the 3S Executor. In the script, it will still be referred to as before. group1.name="Core fragments"; "group1" is named "Core fragments" in the 3S Executor.
fragmentcount number read only Number of fragments in group. group1.fragmentcount
subgroupcount number read only Number of subgroups in group. group1.subgroupcount

LUABaseCell

Commands for the LUABaseCell class. They give information on the structure cells generated on the 3S Generator and loaded into the script.

Properties:

Name Parameters Result Use Example Effect
name string read only Name of the cell. "cell"=cell.name;
sizex number read only Size of the cell along X-axis. cell.sizex
sizey number read only Size of the cell along Y-axis. cell.sizey
sizez number read only Size of the cell along Z-axis. cell.sizez