system.mes.material.newMaterialClass
Description
Generates an empty non-persisted Material Classes object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveMaterialClass method in order to persist the record.
Permissions
This method does not require any permissions.
Syntax
system.mes.material.newMaterialClass()
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
| None | - | - | This method does not take any parameters. |
Returns
Returns a JSON representation of the newly created material class object. The following is a list of keys and default values:
| Key | Default Value |
|---|---|
name | null |
description | null |
path | null |
parentId | null |
id | null |
notes | null |
enabled | true |
spare1 | null |
spare2 | null |
spare3 | null |
Code Examples
# Generate the object structure for a new material class object with no initial arguments
newMaterialClass = system.mes.material.newMaterialClass()
# Set basic attributes for the new material class
newMaterialClass['name'] = 'RAW'
# (You can continue setting other properties as needed here)
# Save the new material class to the system
savedMaterialClass = system.mes.material.saveMaterialClass(**newMaterialClass)
# Output the JSON representation of the saved material class
print(savedMaterialClass)