求助:关于选择集的程序
<p>我写了个保存块的程序,但是保存不了,那位大虾帮帮忙啊!</p><p>Private Sub cmdSave_Click()<br/> Dim uSset As AcadSelectionSet<br/> Dim iCount As Integer<br/> Dim AcadObject As AcadBlock<br/> Dim uBlock(1 To 1) As AcadBlock<br/> Set uSset = ThisDrawing.SelectionSets.Add("WBLOCKSET10")<br/> For Each AcadObject In ThisDrawing.Blocks<br/> If AcadObject.IsLayout = False And AcadObject.Name = ListBox1.Text Then '列表框的内容是要保存的块的名字<br/> Set uBlock(1) = AcadObject<br/> End If<br/> Next<br/> uSset.AddItems uBlock<br/> 'msgbox uSset.count <br/> '我作了下测试,uSset.count还是0.那就是说uSset.AddItems uBlock没有添加成功,这事为什么啊?<br/> ThisDrawing.Wblock "C:\block.dwg", uSset<br/> uSset.Delete<br/>End Sub</p> <p>选择集里只能放模型空间和图纸空间的实体</p><p></p><p>引用ObjectDbx库</p><p>Sub tt()</p><p> Dim blk As AcadBlock<br/> Set blk = ThisDrawing.Blocks("A")<br/> Dim arr() As Object<br/> ReDim arr(blk.Count - 1)<br/> For i = 0 To blk.Count - 1<br/> Set arr(i) = blk(i)<br/> Next<br/> <br/> Dim doc As New AxDbDocument<br/> ThisDrawing.CopyObjects arr, doc.ModelSpace<br/> doc.SaveAs "d:/11.dwg"</p><p>End Sub</p> 非常感谢!
页:
[1]