CAD关于全局字典读扩展记录操作(com接口网页版)
上篇文章写的数据,能过如下方式读取, js代码: function readGlobalVar(sName) { // 得到CAD数据库 var database = mxOcx.GetDatabase(); // 得到全局字典 var dict = database.GetNamedObjectsDictionary(); // 得到用户自定义字典,MyExDataDictName是字典名称 var myDict = dict.GetAt("MyExDataDictName"); if (myDict == null) { // 没有数据。 return ""; } // 得到字典中的扩展记录数据。 var rec = myDict.GetAt(sName); if (rec == null) { // 没有数据。 return ""; } // 得到记录中的数据链表。 var ret = rec.GetXRecordData(); if (ret == null) return ""; // 返回写的数据。 return ret.AtString(0); } 调用代码 : var sRet = readGlobalVar("MyData"); if (sRet == "") { alert("没有数据") } else { alert(sRet); } 来源: https:/