StockMaterial.hardnessUnit Property

Parent Object: StockMaterial
Defined in namespace "adsk::cam" and the header file is <Cam/StockMaterials/StockMaterial.h>

Description

Gets and sets the hardness unit of the stock material. Returns an empty string when no unit is set (including legacy materials with unitless hardness). Standard hardness scales such as "HRC", "HRA", and "HB" are supported, as well as custom unit names. When setting a hardness unit, a hardness value must already be set. Clearing the unit while a hardness value is set is not allowed. Legacy unitless hardness can be read but cannot be created or saved via import or update.

Syntax

"stockMaterial_var" is a variable referencing a StockMaterial object.
# Get the value of the property.
propertyValue = stockMaterial_var.hardnessUnit

# Set the value of the property.
stockMaterial_var.hardnessUnit = propertyValue
"stockMaterial_var" Is a variable referencing a StockMaterial Object.
#include <Cam/StockMaterials/StockMaterial.h>

// Get the value of the property.
string propertyValue = stockMaterial_var->hardnessUnit();

// Set the value of the property, where value_var is a string.
bool returnValue = stockMaterial_var->hardnessUnit(value_var);
"stockMaterial_var" Is a variable referencing a StockMaterial Object.
// Get the value of the property.
propertyValue = stockMaterial_var.hardnessUnit;

// Set the value of the property.
stockMaterial_var.hardnessUnit = propertyValue;

Property Value

This is a read/write property whose value is a string.

Version

Introduced in version October 2026