AttributeDictionary
A named group of key-value pairs attached to a model or entity.
Each dictionary belongs to a named namespace — typically one
per extension, like 'MyPlugin'. Access dictionaries through
the attributes.allDictionaries property on any entity or
model.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();
// Create a door group and store its price as an attributeawait model.performOperation(op => { const groupRef = op.createGroup(model); op.groupSetName(groupRef, 'Door'); op.createFace(groupRef, [ [0,0,0],[36,0,0], [36,0,84],[0,0,84], ]); // Use a unique namespace to avoid collisions // with other extensions op.entitySetAttribute( groupRef, 'MyPricingExtension', 'price', 299 );}, 'Create $299 door');
// Find the dictionary on the grouplet groups = await model.entities.get({ filterBy: { types: ['Group'] },});let door = groups.find(g => g.name === 'Door');let dict = door.attributes .allDictionaries .find(d => d.name === 'MyPricingExtension');
console.log(dict.name);// => 'MyPricingExtension'console.log(dict.values.get('price'));// => 299Properties
Section titled “Properties”attributes
Section titled “attributes”
readonlyattributes:Attributes|undefined
Nested attribute dictionaries on this dictionary.
readonlyname:string
The namespace name of this dictionary, like 'MyPlugin'
or 'GeoReference'.
values
Section titled “values”
readonlyvalues:Map<string,AttributeValue>
The key-value pairs stored in this dictionary. Read-only snapshot — changes here are not sent to SketchUp.
Methods
Section titled “Methods”toString()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string