Skip to main content

system.mes.material.validateMaterialClass

Description

Validates the specified parameters for a Material Classes record and returns any validation errors. This only checks if the material class object can be saved based on the attributes given.

Syntax

system.mes.material.validateMaterialClass(**material_class_data)

Parameters

ParameterTypeDescription
nameStringThe name of the material class.
descriptionStringThe description of the material class.
pathStringThe path to the material class.
parentIdString (ULID)The ULID of the parent material class to this material class.
idString (ULID)The ULID of the material class (optional, used for updating an existing material class).
notesStringNotes related to the material class.
enabledBooleanIndicates if the material class is active and enabled.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional field for user-defined context.

Returns

Returns a JSON object where keys are field names and values are lists of validation violation messages.

Code Examples

# Generate the object structure for a new material class object
material_class_data = system.mes.material.newMaterialClass()

# Set basic attributes for the new material class
material_class_data['name'] = 'RAW'
# (You can continue setting other properties as needed here)

# Validate material class parameters
validation_errors = system.mes.material.validateMaterialClass(**material_class_data)

if len(validation_errors) > 0:
print('Validation errors found:', validation_errors)
else:
print('Material class parameters are valid.')