ProfileSchema

Package: Libraries.Fabrication.Profiles · Inherits from: Libraries.Language.Object

The ProfileSchema class lists every setting a profile can hold, in one place, with its kind, default, allowed range and description. The defaults are the defaults of the geometry classes themselves, so a profile that leaves a setting out behaves exactly as if the matching Set action had never been called. To add a setting: 1. add one line below, 2. pass it on in SliceJob (and BambuSettingsMap if Bambu Studio has a matching key). Two settings with the same key stop the program when the schema is made. ProfileManager, Profile:Validate and the JSON files pick it up on their own.

Actions

Find(text key)

The field with this key, or undefined.

Parameters

  • key text: The key used in profiles.json.

Returns

Libraries.Fabrication.Profiles.ProfileField: The field with this key, or undefined.

Example

use Libraries.Fabrication.Profiles.ProfileSchema
use Libraries.Fabrication.Profiles.ProfileField

ProfileSchema schema
ProfileField field = schema:Find("layerHeight")
output field:GetDefault()      // 0.2

Get(integer index)

A setting by position, in the order the schema lists them.

Parameters

  • index integer: The position, from 0 to GetSize() - 1.

Returns

Libraries.Fabrication.Profiles.ProfileField: The setting.

Example

use Libraries.Fabrication.Profiles.ProfileSchema
use Libraries.Fabrication.Profiles.ProfileField

ProfileSchema schema
integer i = 0
repeat while i < schema:GetSize()
    ProfileField field = schema:Get(i)
    output field:GetKey() + ": " + field:GetDescription()
    i = i + 1
end

GetSize()

The number of settings.

Returns

integer: The number of settings.

Example

use Libraries.Fabrication.Profiles.ProfileSchema

ProfileSchema schema
output schema:GetSize() + " settings"

Has(text key)

Whether a key names a setting.

Parameters

  • key text: The key to look up.

Returns

boolean: True if the schema has the setting.

Example

use Libraries.Fabrication.Profiles.ProfileSchema

ProfileSchema schema
output schema:Has("layerHeight")      // true
output schema:Has("layerHieght")      // false: a typo

Inherited Actions

3 actions from Libraries.Language.Object