AutoCAD.Dictionary

Inherits from AutoCAD.Object

Description

Stores key-value pairs. The key is a text value and the value is an AutoCAD.ObjectId.

This class wraps a subset of the RealDWG AcDbDictionary class functionality.

Applications sometimes store extra data in an object's extension dictionary. You can use this class to access that data:

AutoCAD.ObjectId extDictId = obj.extensionDictionary;
if (extDictId) {
	var extDict = db.openObject(extDictId).as(AutoCAD.Dictionary);
	if (extDict.contains("APPLICATION_ID")) {
		AutoCAD.Xrecord record = extDict.getAt("APPLICATION_ID").as(AutoCAD.Xrecord);
		TypedValueAray values = record.rbChain();
		for (int i = 0; i < values.length; i++) {
			// Use the values in the dictionary.
		}
	}
}

Properties

newIterator Returns an iterator over the contents of the dictionary.
numEntries Returns the number of entries in the dictionary.

Methods

contains Checks whether a given key exists.
getAt Returns the AutoCAD.Object associated with the given key.
remove Removes the key and its associated value.
setAt Adds or replaces the value associated with the specified key.

Static Methods

create Creates a new Dictionary object.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

AutoCAD.Dictionary.newIterator

readonly AutoCAD.DictionaryIterator newIterator

Description

Returns an iterator over the contents of the dictionary.

Do no remove, this fixes the anchor on doc.flexsim.com

AutoCAD.Dictionary.numEntries

readonly int numEntries

Description

Returns the number of entries in the dictionary.

Do no remove, this fixes the anchor on doc.flexsim.com

AutoCAD.Dictionary.contains()

int contains( string key )

Parameters

key The key to check

Returns

int True (1) if the key is present. False (0) otherwise.

Description

Checks whether a given key exists.

Do no remove, this fixes the anchor on doc.flexsim.com

AutoCAD.Dictionary.getAt()

AutoCAD.Object getAt( string key , int openMode = 0 )

Parameters

key The key for the retrieved value
openMode The mode by which to open the object. 0 for read only, 1 for write-enabled.

Returns

AutoCAD.Object The object associated with the key.

Description

Returns the AutoCAD.Object associated with the given key.

Do no remove, this fixes the anchor on doc.flexsim.com

AutoCAD.Dictionary.remove()

remove( string key )

Parameters

key The key to remove.

Description

Removes the key and its associated value.

Do no remove, this fixes the anchor on doc.flexsim.com

AutoCAD.Dictionary.setAt()

setAt( string key , Object value )

Parameters

key The key for the new value
value The value to insert or replace

Description

Adds or replaces the value associated with the specified key.

Do no remove, this fixes the anchor on doc.flexsim.com

AutoCAD.Dictionary.create()

static AutoCAD.Dictionary create( )

Returns

AutoCAD.Dictionary The newly created Dictionary object.

Description

Creates a new Dictionary object.