-
- '创建临时的选择集用户保存显示范围的画叉和数字编号
- Dim SSetOfShow As Object
- Dim pandan As Boolean
- For Each SSetOfShow In objDoc.SelectionSets
- If SSetOfShow.Name = "SSetName" Then
- pandan = True
- Exit For
- End If
- Next
- '判断选择集是否存在
- If pandan Then
- SSetOfShow.Delete '创建集合,如集存在,则删除,新建
- End If
- SSetOfShow = objDoc.SelectionSets.Add("SSetName") '新建选择集
- errTest = True
- '下面的代码在模型空间的每个图
- Dim objEntity(0) As Object
- Dim pt1 As Object
- Dim pt2 As Object
- Dim pt3(2) As Double
- Dim pt4(2) As Double
- Dim ptCen(2) As Double
- Dim i As Integer
- Dim mx As Integer = 0
- For i = 0 To UBound(ptMin)
- pt1 = ptMin(i) : pt2 = ptMax(i)
- pt3(0) = pt1(0) : pt3(1) = pt2(1) : pt3(2) = 0
- pt4(0) = pt2(0) : pt4(1) = pt1(1) : pt4(2) = 0
- ptCen(0) = (pt1(0) + pt2(0)) / 2 : ptCen(1) = (pt1(1) + pt2(1)) / 2 : ptCen(2) = (pt1(2) + pt2(2)) / 2
- objEntity(0) = objDoc.ModelSpace.AddLine(pt1, pt2)
- objEntity(0).Color = 1
- objEntity(0).Update
- [color=] SSetOfShow.AddItems(objEntity) 执行到这里时出错[/color]
- objEntity(0) = objDoc.ModelSpace.AddLine(pt3, pt4)
- objEntity(0).Color = 1
- objEntity(0).Update
- [color=] ' SSetOfShow.AddItems(objEntity)[/color]
- objEntity(0) = objDoc.ModelSpace.AddText(CStr(mx), ptCen, SSetOfShow.Item(SSetOfShow.Count - 1).Length / 5)
- objEntity(0).Color = 1
- objEntity(0).Update
- [color=] 'SSetOfShow.AddItems(objEntity)[/color]
- mx = mx + 1
- Next i
每次直行到SSetOfShow.AddItems(objEntity) 时候出错,错误信息是System.ArgumentException:“参数 pSelSet (位于 AddItems 中) 无效”
求指点一下,
4u14ol1bfsx.png
0ofxauo0qar.png
|