ディクショナリ内の項目や保存された画層設定の名前を変更します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.Rename OldName, NewName
タイプ: Dictionary、LayerStateManager
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: 文字列
ディクショナリ内のオブジェクトの現在の名前(キーワード)または、保存された画層設定セットの名前。
アクセス: 入力のみ
タイプ: 文字列
ディクショナリ内のオブジェクトの新しい名前(キーワード)または、保存された画層設定の新しい名前。
戻り値はありません。
追加の注意はありません。
VBA:
Sub Example_Rename()
' This example creates a dictionary and adds
' a custom object to that dictionary. It then
' renames 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)
' Rename the object
dictObj.Rename keyName, "NewKeyName"
End Sub
Public Sub Example_RenameLayerSettings()
' This example renames a set of saved layer settings from
' "ColorLinetype" to "OldColorLinetype."
Dim oLSM As AcadLayerStateManager
' Access the LayerStateManager object.
Set oLSM = ThisDrawing.Application. _
GetInterfaceObject("AutoCAD.AcadLayerStateManager.19")
' Associate the current drawing database with the
' LayerStateManager object.
oLSM.SetDatabase ThisDrawing.Database
' Rename the saved layer settings.
oLSM.Rename "ColorLinetype", "OldColorLinetype"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_Rename()
;; This example creates a dictionary and adds
;; a custom object to that dictionary. It then
;; renames the object in the 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))
;; Rename the object
(vla-Rename dictObj keyName "NewKeyName")
)
(defun c:Example_RenameLayerSettings()
;; This example renames a set of saved layer settings from
;; "ColorLinetype" to "OldColorLinetype."
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Access the LayerStateManager object.
(setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.19"))
;; Associate the current drawing database with the
;; LayerStateManager object.
(vla-SetDatabase oLSM (vla-get-Database doc))
(vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))
;; Rename the saved layer settings.
(vla-Rename oLSM "ColorLinetype" "OldColorLinetype")
)