LUAPacker
[Desktop Automation]
An instance of this object is returned by the createpacker
function of the LUATray
(see LUATray) object. It is used to pack the content of trays. When packers are created, they take a snapshot of the tray which they work on. Any meshes added or removed after the packer instance is created do not factor into its packing results.
Properties
Some or all of these properties apply to the packer method of choice.
Property | Read/write | Type | Description |
---|---|---|---|
borderspacingxy | read/write | Number | The desired minimal distance from the border of the tray. The default value is 0 mm. |
borderspacingz | read/write | Number | The desired minimal distance from the build platform ceiling of the tray. The default value is 0 mm. |
defaultpartrotation | read/write | Integer | Permits or restricts rotation for finding better fits. The values can be 0 (Arbitrary), 1 (z-axis), 2 (no rotation), default value is 0. That this property may be overridden per part by adjusting its individual packing property. |
minimaldistance | read/write | Number | The desired minimal distance between the parts in the tray. The default value is 1 mm. |
optInteger | Read | Number | Constant for parameter type Integer |
optFloat | Read | Number | Constant for parameter type Float |
optBoolean | Read | Number | Constant for parameter type Boolean |
parametercount | Read | Number | The number of parameters of the packer. Use the methods tray:getparameter… to get details about any parameters. |
[Additional Parameter Name] | read/write | Number | Read or write the packer-specific parameters. Refer to the documentation of the packer implementations for details. |
Methods
Name | Syntax | Description |
---|---|---|
getoutbox | Result = Packer:getoutbox() | Returns the dimensions of the current tray as a TLUAOutbox with its minx, miny, maxy, maxy coordinates. |
getparametername | Result = packer:getparametername(Index: Number) | Returns the name of the parameter with the given index. See tray.parametercount for the number of parameters available. |
getparametertype | Result = packer:getparametertype(Index: Number) | Returns the type of the parameter with the given index as string (integer , float , Boolean ). See tray.parametercount for the number of parameters available. |
getparametertypeid | Result = packer: getparametertypeid(Index: Number) | Returns the name of the parameter with the given index as constant (see LUAPacker.optInteger, LUAPacker.optFloat, LUAPacker.optBoolean). See tray.parametercount for the number of parameters available. |
getparametervalue | Result = packer: getparametervalue(Index: Number) | Returns the value of the parameter with the given index. Note that the type of the returned value differs depending on the type of the parameter. See tray.parametercount for the number of parameters available. |
pack | Result = packer:pack() | Pack the tray with the desired algorithm. Returns a packer-specific error code (general: 0 = no error) |
setoutbox | Packer:setoutbox(Outbox:TLUAOutbox) | Sets the dimension of the tray to be packed. This can be used to pack only a fraction of the tray. |