本帖最后由 dong20030432 于 2018-3-7 14:53 编辑
自己用VB做一个程序,需要把选择集中的实体放到块中,在网上查到用copyobjects方法,但运行过程中总是报错(最后一行),请大家帮忙看下怎么回事。如果有其它方法,麻烦告诉我一下,感激不尽,谢谢了!!!
- Dim NoNamBlo As AcadBlock
- Dim BasePnt As Variant
- Dim Ent() As Object
- Dim ownName As String
- On Error Resume Next
- Set sset = AcadApp.ActiveDocument.SelectionSets.Item("ss1")
- sset.Delete
- Set sset = AcadApp.ActiveDocument.SelectionSets.Add("ss1")
- AppActivate AcadApp.Caption
- AcadApp.ActiveDocument.Utility.Prompt "请选择要建立块的对象"
- sset.SelectOnScreen
- BasePnt = AcadApp.ActiveDocument.Utility.GetPoint(, "请拾取块基点")
- Set NoNamBlo = AcadApp.ActiveDocument.Blocks.Add(BasePnt, "*u")
- ownName = NoNamBlo.Name
- ReDim Ent(sset.Count)
- For i = 0 To sset.Count - 1
- Set Ent(i) = sset.Item(i)
- Next
- AcadApp.ActiveDocument.CopyObjects Ent, NoNamBlo
|