请教斑竹,能否编程实现分别插入N个块,并在最后合并为一个块的功能
由于我插入的图形模块需要分好几个分别插入,因为每个部分插入图中的方向和位置必须由用户自己确定,完成插入以后,自动将这些块并成一个整体(块),请教斑竹,不知道这个功能能否实现。我查了很久资料,仍无结果 插入完成以后,将生成的块全部插入到一个块中,炸开就可以了,最好用无名块实现 <A name=23963><FONT color=#0000ff><B>lzh741206:</B></FONT></A>恕兄弟愚钝,斑竹可否提供一个例子来详细解释实现过程 Public Sub test()<BR>Dim pBlocks(1) As AcadBlock<BR>Dim myBlock As AcadBlock<BR>Dim pnt(2) As Double<BR>Dim p1(2) As Double, p2(2) As Double<BR>Dim obj(1) As AcadBlockReference<BR>Set pBlocks(0) = ThisDrawing.Blocks.Add(pnt, "*U")<BR>Set pBlocks(1) = ThisDrawing.Blocks.Add(pnt, "*U")<BR>p2(1) = 10<BR>pBlocks(0).AddLine p1, p2<BR>p1(0) = 10<BR>pBlocks(0).AddLine p1, p2<BR>p2(1) = 20<BR>pBlocks(1).AddLine p1, p2<BR>p1(0) = 20<BR>pBlocks(1).AddLine p1, p2<BR>Set obj(0) = ThisDrawing.ModelSpace.InsertBlock(ThisDrawing.Utility.GetPoint, pBlocks(0).Name, 1, 1, 1, 0)<BR>Set obj(1) = ThisDrawing.ModelSpace.InsertBlock(ThisDrawing.Utility.GetPoint, pBlocks(1).Name, 1, 1, 1, 0)<BR>Set myBlock = ThisDrawing.Blocks.Add(pnt, "*U")<BR>myBlock.InsertBlock obj(0).InsertionPoint, pBlocks(0).Name, 1, 1, 1, 0<BR>myBlock.InsertBlock obj(1).InsertionPoint, pBlocks(1).Name, 1, 1, 1, 0<BR>ThisDrawing.ModelSpace.InsertBlock pnt, myBlock.Name, 1, 1, 1, 0<BR>obj(0).Delete<BR>obj(1).DeleteEnd Sub<BR> 谢谢斑竹 搞定 <p>我试了试,还是不懂如何新建一个块,将零散的几个块包括在内。</p><p>是不是块名的问题?能不能给个更详细的解释?</p><p>比如要包含在块“zhangsan”内的块名“zhangsan”、“lisi”、“wangwu”、“zhaoliu”</p>
页:
[1]