オブジェクト名を指定します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.Name
タイプ: Application、Block、BlockReference、ComparedReference、Dictionary、DimStyle、Document、ExternalReference、GeomapImage、Group、Layer、Layout、Linetype、Material、MenuGroup、MInsertBlock、MLeaderStyle、ModelSpace、PaperSpace、PlotConfiguration、PointCloud、PointCloudEx、PopupMenu、RasterImage、RegisteredApplication、Section、SelectionSet、Shape、TableStyle、TextStyle、Toolbar、ToolbarItem、UCS、View、Viewport、Wipeout、XRecord
このプロパティが適用されるオブジェクト。
タイプ: 文字列
オブジェクトの名前。
Application、Document: このプロパティはパスではなくファイル名のみを返します。
ToolbarItem: この名前はツールチップ テキストとして使用されます。
MenuGroup: この名前は 32 文字までに制限され、空白や区切り記号を含むことができません。
Raster: このプロパティは、パス情報を含まないこと以外は ImageFile プロパティと同じです。
XRecord: オブジェクトのこのオブジェクトが含まれているディクショナリ内での名前。この名前はオブジェクトのクラス名を表しません。
BlockRef: ブロック参照には、図面内の有効なブロック定義のみの名前を割り当てることができます。固有の名前をブロック参照に割り当てても、新しいブロック定義は自動的に作成されません。新しいブロック定義を作成するには、Add メソッドを使用して新しい Block オブジェクトを Blocks コレクションに追加します。
VBA:
Sub Example_Name()
' This example creates a new layer. It then
' changes the name of that layer.
' Add the new layer
Dim layerObj As AcadLayer
Set layerObj = ThisDrawing.Layers.Add("NewLayer")
' Find the name of the new layer
Dim layerName As String
layerName = layerObj.name
MsgBox "A new layer was created with the name: " & layerObj.name, , "Name Example"
' Change the name of the layer to "TEST". Note that behavior of the
' following code will be different for different objects. In some cases such as
' Block reference, changing the name means referencing to a new Block and therefore
' a Block with named "TEST" should already exist: otherwise an error will be
' returned.
layerObj.name = "TEST"
layerName = layerObj.name
MsgBox "The new name of the layer is: " & layerObj.name, , "Name Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_Name()
;; This example creates a new layer. It then
;; changes the name of that layer.
(setq acadObj (vlax-get-acad-object)
doc (vla-get-ActiveDocument acadObj))
;; Add the new layer
(setq layerObj (vla-Add (vla-get-Layers doc) "NewLayer"))
;; Find the name of the new layer
(setq layerName (vla-get-Name layerObj))
(alert (strcat "A new layer was created with the name: " layerName))
;; Change the name of the layer to "TEST". Note that behavior of the
;; following code will be different for different objects. In some cases such as
;; Block reference, changing the name means referencing to a new Block and therefore
;; a Block with named "TEST" should already exist: otherwise an error will be
;; returned.
(vla-put-Name layerObj "TEST")
(setq layerName (vla-get-Name layerObj))
(alert (strcat "The new name of the layer is: " layerName))
)