ErPotenza
2007-02-13 08:36:44 UTC
I'm doing some tests with VBA and I'm having a problem:
Public Sub Test()
Dim p1 As Point
Set p1 = Library.CreatePoint(0, 0, 0)
Dim p2 As Point
Set p2 = Library.CreatePoint(50, 50, 0)
Dim l As Line
Set l = ThisDocument.ModelSpace.AddLine(p1, p2)
Dim h As String
h = l.Handle
l.Delete
Dim o As Object
Set o = ThisDocument.HandleToObject(h)
End Sub
On the last line of the Sub,
Set o = ThisDocument.HandleToObject(h)
h is the handle of a deleted line, but HandleToObject returns the line
without a problem. In Autocad a similar situation would raise an
exeption. Is it possible to know when, given a handle, the respective
entity exists or not?
Thanks
Public Sub Test()
Dim p1 As Point
Set p1 = Library.CreatePoint(0, 0, 0)
Dim p2 As Point
Set p2 = Library.CreatePoint(50, 50, 0)
Dim l As Line
Set l = ThisDocument.ModelSpace.AddLine(p1, p2)
Dim h As String
h = l.Handle
l.Delete
Dim o As Object
Set o = ThisDocument.HandleToObject(h)
End Sub
On the last line of the Sub,
Set o = ThisDocument.HandleToObject(h)
h is the handle of a deleted line, but HandleToObject returns the line
without a problem. In Autocad a similar situation would raise an
exeption. Is it possible to know when, given a handle, the respective
entity exists or not?
Thanks