オブジェクトの画層を指定します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.Layer
タイプ: すべての図形オブジェクト、AttributeReference、Group、SubDMeshEdge、SubDMeshFace、SubDMeshVertex、SubEntity、SubEntSolidEdge、SubEntSolidFace、SubEntSolidNode、SubEntSolidVertex
このプロパティが適用されるオブジェクト。
読み込み専用: いいえ(書き込み専用の Group オブジェクトを除く)
タイプ: 文字列
画層の名前
すべてのオブジェクトは画層に関連付けられています。データベースには常に最低 1 つの画層(画層 0)があります。線種の場合と同様、オブジェクトに画層を指定することができます。画層を指定しないと、現在のアクティブな画層が新しいオブジェクトに使用されます。オブジェクトに画層を指定すると、現在のアクティブな画層は無視されます。現在のアクティブな画層を設定または取得するには、ActiveLayer プロパティを使用します。
各画層には、Layer オブジェクトを介して設定、取得可能な関連プロパティがあります。
VBA:
Sub Example_Layer()
    ' This example creates a new layer named "ABC" (colored blue).
    ' It then creates a circle and assigns it to layer "ABC"
    ' Create new layer
    Dim layerObj As AcadLayer
    Set layerObj = ThisDrawing.Layers.Add("ABC")
    Dim color As AcadAcCmColor
	   Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor." & Left(AcadApplication.Version, 2))
    Call color.SetRGB(80, 100, 244)
    layerObj.TrueColor = color
    
    ' Create Circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1.5
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll
    MsgBox "The circle has been created on layer " & circleObj.Layer, , "Layer Example"
        
    ' Set the layer of new circle to "ABC"
    circleObj.Layer = "ABC"
    ' Refresh view
    ThisDrawing.Regen (True)
    MsgBox "The circle is now on layer " & circleObj.Layer, , "Layer Example"
    
End Sub
 
  Visual LISP:
(vl-load-com)
(defun c:Example_Layer()
    ;; This example creates a new layer named "ABC" (colored blue).
    ;; It then creates a circle and assigns it to layer "ABC"
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
 
    ;; Create new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "ABC"))
    (setq color (vlax-create-object (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))))
    (vla-SetRGB color 80 100 244)
    (vla-put-TrueColor layerObj color)
    
    ;; Create Circle
    (setq center (vlax-3d-point 3 3 0)
          radius 1.5)
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)
    (alert (strcat "The circle has been created on layer " (vla-get-Layer circleObj)))
        
    ;; Set the layer of new circle to "ABC"
    (vla-put-Layer circleObj "ABC")
    ;; Refresh view
    (vla-Regen doc :vlax-true)
    (alert (strcat "The circle is now on layer " (vla-get-Layer circleObj)))
    (vlax-release-object color)
)