获取字典中对象的名称(关键字)。 支持的平台:仅窗口 返回值(RetVal)类型:字符串 对象的名称(关键字)。 言论例如,在以下字典中查询对象“Object2”将返回名称“SecondKeyword”: 我的词典 关键字 - 对象 第一个关键字 - 对象1 第二关键字 - 对象2 例子工 务 局: Sub Example_GetName() ' This example creates a dictionary and adds ' a custom object to that dictionary. It then ' finds the name of the object in the dictionary. Dim dictObj As AcadDictionary Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY") ' Load the ObjectARX application that defines the custom object. ' Note: The application listed here does not exist and ' will cause an error when run. Change the application name ' to the path and name of your ObjectARX application. ThisDrawing.Application.LoadArx "MyARXApp.dll" ' Create the custom object in the dictionary Dim keyName As String Dim className As String Dim customObj As AcadObject keyName = "OBJ1" className = "CAsdkDictObject" Set customObj = dictObj.AddObject(keyName, className) ' Find the keyword name of an object in the dictionary keyName = dictObj.GetName(customObj) End Sub Visual LISP: (vl-load-com) (defun c:Example_GetName() ;; This example creates a dictionary and adds ;; a custom object to that dictionary. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq dictionaries (vla-get-Dictionaries doc)) (setq dictObj (vla-Add dictionaries "TEST_DICTIONARY")) ;; Load the ObjectARX application that defines the custom object. ;; Note: The application listed here does not exist and ;; will cause an error when run. Change the application name ;; to the path and name of your ObjectARX application. (vla-LoadArx acadObj "MyARXApp.dll") ;; Create the custom object in the dictionary (setq keyName "OBJ1") (setq className "CAsdkDictObject") (setq customObj (vla-AddObject dictObj keyName className)) ;; Find the keyword name of an object in the dictionary (setq keyName (vla-GetName dictObj customObj)) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:44
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.