Blocks プロパティ(ActiveX)

図面の Blocks コレクションを取得します。

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

構文と要素

VBA:

object.Blocks
object

タイプ: DatabaseDocument

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

プロパティの値

読み込み専用: はい

タイプ: Blocks

図面の Blocks コレクション。

注意

追加の注意はありません。

VBA:

Sub Example_Blocks()
    ' This example first finds the Blocks collection
    ' using the Blocks property. It then adds a new
    ' block to the Blocks collection.
    
    Dim blkColl As AcadBlocks
    Dim newBlock As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    
    ' Get the Blocks collection
    Set blkColl = ThisDrawing.Blocks
    
    ' Define the insertion point for the new block
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    
    ' Add the new block into the Blocks collection
    Set newBlock = blkColl.Add(insertionPnt, "TEST")
    MsgBox "A block called " & newBlock.name & " has been added to the blocks collection", vbInformation, "Blocks Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Blocks()
    ;; This example first finds the Blocks collection
    ;; using the Blocks property. It then adds a new
    ;; block to the Blocks collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Get the Blocks collection
    (setq blkColl (vla-get-Blocks doc))
    
    ;; Define the insertion point for the new block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    
    ;; Add the new block into the Blocks collection
    (setq newBlock (vla-Add blkColl insertionPnt "TEST"))
    (alert (strcat "A block called " (vla-get-Name newBlock) " has been added to the blocks collection."))
)