IsLayout プロパティ(ActiveX)

指定されたブロックがレイアウト ブロックかどうかを決定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.IsLayout
object

タイプ: Block

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: はい

タイプ: ブール型

注意

IsLayout プロパティは IsXRef プロパティと一緒に機能します。両方のプロパティが False である場合、ブロックは単純なブロックです。IsXRef プロパティが True である場合、ブロックは外部参照です。IsLayout プロパティが True である場合、ブロックはレイアウトに関連付けられたすべてのジオメトリを含みます。

VBA:

Sub Example_IsLayout()
    ' This example cycles through each Block object in a drawing
    ' and determines whether style of each Block by accessing the
    ' IsLayout and IsXRef properties.  A Block
    ' object is also added at runtime so the results are mixed and do not only
    ' come from the default Blocks.
    
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newBlock As AcadBlock, insertedBlock As AcadBlockReference
    Dim tempBlock As AcadBlock
    Dim msg As String
    
    ' Define the Circle object that will be inserted into the block
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    radius = 0.5
    
    ' Create a new block to hold the Circle object
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")
    
    ' Add the Circle object to the new block object
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)
    
    ' Add the new block to model space
    Set insertedBlock = ThisDrawing.ModelSpace.InsertBlock(InsertPoint, "CBlock", 1, 1, 1, 0)
        
    ThisDrawing.Application.ZoomAll
    
    msg = vbCrLf & vbCrLf
    
    For Each tempBlock In ThisDrawing.Blocks
        If Not (tempBlock.IsLayout) And Not (tempBlock.IsXRef) Then
            ' Block is simple
            msg = msg & tempBlock.name & ": Simple"
        ElseIf tempBlock.IsXRef Then
            ' Block is an external reference
            msg = msg & tempBlock.name & ": External Reference"
            If tempBlock.IsLayout Then
                ' Block also contains layout geometry
                msg = msg & tempBlock.name & " and Contains Layout Geometry"
            End If
        ElseIf tempBlock.IsLayout Then
            ' Block contains layout geometry
            msg = msg & tempBlock.name & ": Contains Layout Geometry"
        End If
        
        msg = msg & vbCrLf      ' Move to next line
    Next
        
    ' Display Block information for this drawing
    MsgBox "Blocks in this drawing have the following styles: " & msg

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsLayout()
    ;; This example cycles through each Block object in a drawing
    ;; and determines whether style of each Block by accessing the
    ;; IsLayout and IsXRef properties.  A Block
    ;; object is also added at runtime so the results are mixed and do not only
    ;; come from the default Blocks.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Define the Circle object that will be inserted into the block
    (setq centerPoint (vlax-3d-point 0 0 0)
          insertPoint (vlax-3d-point 1 1 0)
          radius 0.5)
    
    ;; Create a new block to hold the Circle object
    (setq newBlock (vla-Add (vla-get-Blocks doc) centerPoint "CBlock"))
    
    ;; Add the Circle object to the new block object
    (setq circleObj (vla-AddCircle (vla-Item (vla-get-Blocks doc) "CBlock") centerPoint radius))
    
    ;; Add the new block to model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq insertedBlock (vla-InsertBlock modelSpace InsertPoint "CBlock" 1 1 1 0))
        
    (vla-ZoomAll acadObj)
    
    (setq msg "")
    
    (vlax-for tempBlock (vla-get-Blocks doc)
        (cond
            ((and (= (vla-get-IsLayout tempBlock) :vlax-false)
                  (= (vla-get-IsXRef tempBlock) :vlax-false))
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": Simple"))
            )
            ((= (vla-get-IsXRef tempBlock) :vlax-true)
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": External Reference"))
                (if (= (vla-get-IsLayout tempBlock) :vlax-true)
                    ;; Block also contains layout geometry
                    (setq msg (strcat msg (vla-get-Name tempBlock) " and Contains Layout Geometry"))
                )
            )
            ((= (vla-get-IsLayout tempBlock) :vlax-true)
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": Contains Layout Geometry"))
            )
        )
        (setq msg (strcat msg "\n"))
    )
        
    ;; Display Block information for this drawing
    (alert (strcat "Blocks in this drawing have the following styles: " msg))
)