Skip to content

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.

let model = await SketchUpApi.getActiveModel();
// Create a door group and store its price as an attribute
await 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 group
let 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'));
// => 299

readonly attributes: Attributes | undefined

Nested attribute dictionaries on this dictionary.


readonly name: string

The namespace name of this dictionary, like 'MyPlugin' or 'GeoReference'.


readonly values: Map<string, AttributeValue>

The key-value pairs stored in this dictionary. Read-only snapshot — changes here are not sent to SketchUp.