Columns Property (ActiveX)

Specifies the number of columns in a block array or table.

Supported platforms: Windows only

Signature

VBA:

object.Columns
object

Type: MInsertBlock, Table

The object this property applies to.

Property Value

Read-only: No

Type: Long

The number of columns in the block array or table.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Columns()
    ' This example creates a new MInsertBlock in the current drawing and
    ' displays the column and row information for the new MInsertBlock
    
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newMBlock As AcadMInsertBlock
    Dim newBlock As AcadBlock
        
    ' Define the Circle object
    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
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")
    
    ' Add the Circle object to the new block
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)
    
    ' Create a rectangular array of Circles using the new block containing the Circle
    ' and the AddMInsertBlock method
    Set newMBlock = ThisDrawing.ModelSpace.AddMInsertBlock(InsertPoint, "CBlock", 1, 1, 1, 1, 2, 2, 1, 1)
        
    ThisDrawing.Application.ZoomAll
    
    ' Display information about the Columns and Rows defined by the MInsertBlock
    MsgBox "The new rectangular array comprises: " & vbCrLf & _
            newMBlock.Columns & " columns with a spacing of " & newMBlock.ColumnSpacing & " and" & vbCrLf & _
            newMBlock.Rows & " rows with a spacing of " & newMBlock.RowSpacing

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Columns()
    ;; This example creates a new MInsertBlock in the current drawing and
    ;; displays the column and row information for the new MInsertBlock
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
        
    ;; Define the Circle object
    (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
    (setq newBlock (vla-Add (vla-get-Blocks doc) centerPoint "CBlock"))
    
    ;; Add the Circle object to the new block
    (setq circleObj (vla-AddCircle newBlock centerPoint radius))
    
    ;; Create a rectangular array of Circles using the new block containing the Circle
    ;; and the AddMInsertBlock method
    (setq modelSpace (vla-get-ModelSpace doc))   
    (setq newMBlock (vla-AddMInsertBlock modelSpace InsertPoint "CBlock" 1 1 1 1 2 2 1 1))
        
    (vla-ZoomAll acadObj)
    
    ;; Display information about the Columns and Rows defined by the MInsertBlock
    (alert (strcat "The new rectangular array comprises: \n"
                   (itoa (vla-get-Columns newMBlock)) " columns with a spacing of " (rtos (vla-get-ColumnSpacing newMBlock) 2) " and\n"
                   (itoa (vla-get-Rows newMBlock)) " rows with a spacing of " (rtos (vla-get-RowSpacing newMBlock) 2) "."))
)