From OpenSCADAWiki
User programming API
Due to the support of the logical type parameters, it makes sense to provide a number of functions of the user API for calling them from the template of the logical parameter.
The object "Parameter" [this]
- bool attrAdd( string id, string name, string tp = "real", string selValsNms = "" ) [for enabled parameter of the logical type] — adds the attribute id with the name name and the type tp. If the attribute is already present, the properties will be applied that can be changed on the go: name, selection mode and selection options.
- id, name — identifier and name of the new attribute;
- tp — attribute type [boolean | integer | real | string | text | object] + selection mode [sel | seled] + read-only [ro];
- selValsNms — two lines with values in first and their names in second, separated by ";".
- bool attrDel( string id ) [for enabled parameter of the logical type] — removes the attribute id.