插入已在当前图形中定义的图形文件或命名块。 支持的平台:仅窗口 签名工 务 局: RetVal = object.InsertBlock(InsertionPoint, Name [, Xscale [, Yscale [, ZScale [, Rotation [, Password]]]]])
言论将一个块插入另一个块将创建嵌套块。 尝试使用未初始化的Name参数调用该方法会导致意外行为。InsertBlock ExamplesVBA: Sub Example_InsertBlock() ' This example creates a block containing a circle. ' It then inserts the block. ' Create the block Dim blockObj As AcadBlock Dim insertionPnt(0 To 2) As Double insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0# Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock") ' Add a circle to the block Dim circleObj As AcadCircle Dim center(0 To 2) As Double Dim radius As Double center(0) = 0: center(1) = 0: center(2) = 0 radius = 1 Set circleObj = blockObj.AddCircle(center, radius) ' Insert the block Dim blockRefObj As AcadBlockReference insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0 Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0) ZoomAll End Sub Visual LISP: (vl-load-com) (defun c:Example_InsertBlock() ;; This example creates a block containing a circle. ;; It then inserts the block. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create the block (setq insertionPnt (vlax-3d-point 0 0 0)) (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "CircleBlock")) ;; Add a circle to the block (setq center (vlax-3d-point 0 0 0) radius 1) (setq circleObj (vla-AddCircle blockObj center radius)) ;; Insert the block (setq insertionPnt (vlax-3d-point 2 2 0)) (setq modelSpace (vla-get-ModelSpace doc)) (setq blockRefObj (vla-InsertBlock modelSpace insertionPnt "CircleBlock" 1 1 1 0)) (vla-ZoomAll acadObj) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:07
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.