插入块数组。 支持的平台:仅窗口 签名工 务 局: RetVal = object.AddMInsertBlock(InsertionPoint, Name, XScale, YScale, ZScale, Rotation, NumRows, NumColumns, RowSpacing, ColumnSpacing [, Password])
RemarksThe following illustration shows an array of inserted blocks. Original block Array of inserted blocks ExamplesVBA: 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.") ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:18
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.