Share
 
 

Attributes and Parameters

Within Buildstyles, attributes as well as parameters can be declared. But what is the difference?

Parameters

Buildstyle parameters are defined in a function called declareParameters. Every parameter has to be part of a parameter group and can store a unique string value and a description. Note that parameter values can be read out everywhere in the buildstyle scripts, but it isn’t possible to change parameter values within the scripts.

Parameter values can only be set by a parent process before buildstyles are executed. Every part of the platform setup in the Export Test Build dialog, for example, can be processes with a different set of buildstyle parameters.

Parameter values can have one of four different types:

  • Integer: Integer parameters are defined with a minimum, a maximum, and a default value.
  • Floating point: Like integer parameters, floating point parameters are defined with a minimum, a maximum, and a default value.
  • Boolean: Boolean parameters are defined with a default boolean value.
  • Choice (Enum): Enum parameters are defined with a list of possible values, separated with a semicolon (;), such as low; high, and one default value.
exports.declareParameters = function(parameter)
{
  // create parameter group for exposure parameter
  parameter.declareParameterGroup("exposure", "Exposure");
  // area offset parameter 
  parameter.declareParameterReal("exposure", "offset", "Area offset", -150.0, 150.0, 1.0);
}

EBPA Parameters are organised in groups. You can enable or disable a whole parameter group using the nGroupOptional flag, an attribute, to support the "enable/disable" feature.

nAttributes |= nGroupOptional;
parameter.declareParameterGroup("exposure", "Exposure", "This is the exposure parameter", nAttributes)

Attributes

While parameters are mostly used to modify the behavior of buildstyles, attributes are used to control the 3D printing machine or internal buildstyle processes.

Hatch Attributes
Defining attributes for hatch objects allows the buildstyle scripts to assign attribute values to a toolpath section, and it may be used to configure machine specific attributes like speed or power. Attribute names are user-defined attribute values that can be integer or float values.
var hatchData = new HATCH.bsHatch();
hatchData.setAttributeInt("power", 120);
hatchData.setAttributeReal("speed", 515.0); 
Layer Attributes
String attributes can be assigned to part layers. This is used to store values at the processing step of the buildstyle at layer level. The export step will be able to retrieve these values.
var layer = currentModel.getModelLayer(layerZPos); 
// add custom printer setting to layer 
layer.setAttrib(attrPrinterSettings, 
                JSON.stringify(defaultPrintSettings));

Was this information helpful?