在找尺寸线的起点和终点坐标时,经常会出现如下情况。
2145386484--未知句柄
扫描获得的实体Handle号根据Handle获得的HANDLEError Number备注541FB541FB0扫描获得的Handle与图形中Handle相同5410000000 -2145386484扫描获得的Handle与图形中Handle不相同5.41e+011 -2145386484扫描获得的Handle与图形中Handle不相同531 -2145386484扫描获得的Handle与图形中Handle不相同39800000000 -2145386484扫描获得的Handle与图形中Handle不相同3.8e+079 -2145386484扫描获得的Handle与图形中Handle不相同393000000 -2145386484扫描获得的Handle与图形中Handle不相同3.8e+021 -2145386484扫描获得的Handle与图形中Handle不相同38EE638EE60扫描获得的Handle与图形中Handle相同38ED038ED00扫描获得的Handle与图形中Handle相同3.8e+063 -2145386484扫描获得的Handle与图形中Handle不相同- Sub mmm()
- Dim xlSheet3 As Worksheet
- Set xlSheet3 = ReturnxlSheet("Sheet3")
- Dim objDim As AcadDimension
- With xlSheet3
- For ii = 2 To .Range("A65355").End(xlUp).Row
- On Error Resume Next
- Set objDim = ThisDrawing.HandleToObject(.Cells(ii, 1))
- objDim.Layer = "虚线"
- If Err.Number = 0 Then
- .Cells(ii, 5) = objDim.Handle
- .Cells(ii, 6) = objDim.Layer
- End If
- .Cells(ii, 7) = Err.Number
- Next ii
- End With
- Dim ent As AcadEntity
- End Sub
- 原因
- 在http://forums.augi.com/archive/index.php/t-5547.html有这段描述
- 'Not a valid handle. 未知句柄
- This could be an older block that doesn't follow the pattern of BlockBegin's handle starting at 1 above the block handle. Continue the loop until you find it. BlockEnd should still be 1 above BlockBegin.
- 这是老版本生成的块,不能随父节点在块开始点1之上找到块关联句柄。只有不断循环才能找到它,块的结束部分仍然在块开始的1上。
-
|