Some properties return array of IDispatch which cannot be used in vbscript of formula definition, for instance the attributes returned by BlockReference are of VarType 8201 which is indicates an array of IDispatch pointers.
Using ConvertToVariantArray can convert it to array of variant so that the elements can be reached in vbscript, just like the way how it converts a point value (array of double).
NOTE: AutoCAD.Application.24 – AutoCAD 2021
AecX.AecBaseApplication.8.3 – AutoCAD Architecture 2021.
To know versions of various AEC libraries installed AutoCAD Architecture.
Take a note of ACADVER of your current installed AutoCAD.
AutoCAD Architecture | ACADVER | AEC Lib |
2021 | 24.0 | 8.3 |
2020 | 23.1 | 8.2 |
2019 | 23.0 | 8.1 |
2018 | 22.0 | 8.0 |
2017 | 21.0 | 7.9 |
2016 | 20.1 | 7.8 |
2015 | 20.0 | 7.7 |
2014 | 19.1 | 7.5 |
2013 | 19.0 | 7.0 |
2012 | 18.2 | 6.7 |
RESULT="--"
On Error Resume Next
set acad = GetObject(, "AutoCAD.Application.24")
set aec = acad.GetInterfaceObject("AecX.AecBaseApplication.8.3")
aec.Init acad
set utility = aec.ActiveDocument.Utility
set obj = acad.ActiveDocument.ObjectIDToObject([ObjectID])
attributes = utility.ConvertToVariantArray(obj.GetAttributes)
set attribute = attributes(0)
RESULT = attribute.TextString