CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

AddMInsertBlock Method (ActiveX)

2023-1-4 12:47| 发布者: admin| 查看: 700| 评论: 0|来自: AutoCAD

摘要: 插入块数组。

插入块数组。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.AddMInsertBlock(InsertionPoint, Name, XScale, YScale, ZScale, Rotation, NumRows, NumColumns, RowSpacing, ColumnSpacing [, Password])
对象

类型:模型空间,图纸空间

此方法适用的对象。

插入点

访问:仅输入

类型:变体(双精度的三元素数组)

插入块数组的 3D WCS 坐标。

名字

访问:仅输入

类型:字符串

的名称。MInsertBlock

注意:在插入过程中,您不能在名称前面加上星号来分隔块的对象,就像使用标准 Block 一样。MInsertBlock
XScale

访问:仅输入

类型:

X比例因子。

伊斯卡尔

访问:仅输入

类型:

Y比例因子。

ZScale

访问:仅输入

类型:

Z比例因子。

旋转

访问:仅输入

类型:

以弧度为单位的旋转角度。

行数

访问:仅输入

类型:

一个正整数,表示数组的行数。

列数

访问:仅输入

类型:

一个正整数,表示数组的列数。

行距

访问:仅输入

Type: Double

The distance between the array rows.

ColumnSpacing

Access: Input-only

Type: Double

The distance between the array columns.

Password

Access: Input-only

Type: Variant

The password that is required to open and insert the drawing.

Return Value (RetVal)

Type: MInsertBlock

The newly created array of blocks.

Remarks

The following illustration shows an array of inserted blocks.



Original block



Array of inserted blocks

Examples

VBA:

Sub Example_AddMInsertBlock()
    ' This example creates a new Block in the current drawing, adds a
    ' Circle object to the new block, and uses the newly created block
    ' to create a rectangular array of block references using AddMInsertBlock
    
    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 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)
    
    ' 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
    
    MsgBox "A rectangular array has been created from the original block."

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddMInsertBlock()
    ;; This example creates a new Block in the current drawing, adds a
    ;; Circle object to the new block, and uses the newly created block
    ;; to create a rectangular array of block references using AddMInsertBlock
    (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 blocks (vla-get-Blocks doc))
    (setq newBlock (vla-Add blocks centerPoint "CBlock"))
    
    ;; Add the Circle object to the new block object
    (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)
    
    (alert "A rectangular array has been created from the original block.")
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 04:36

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部