使用任何对象方法和属性来重新定义块。Block 重新定义块时,图形中对该块的所有参照都会立即更新以反映新定义。 重新定义会影响块的先前和未来插入。常量属性将丢失,并被任何新的常量属性替换。即使新块没有属性,变量属性也保持不变。 重新定义块定义中的对象此示例创建一个块,并在该块的定义中添加一个圆圈。然后,将块作为块参照插入到图形中。模块定义中的圆圈将更新,块参照将自动更新。 Sub Ch10_RedefiningABlock() ' Define 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 ' Redefine the circle in the block, ' and update the block reference circleObj.radius = 3 blockRefObj.Update End Sub 父主题: |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:38
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.