Message 1 of 8
Updating Xrecords?

Not applicable
05-18-2004
10:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is it possible to "update" an x-record or does it have to be deleted and
re-created?
I have a "table" of drawing revisions I keep in a dictionary, these are
editable via
a form. In the form I pass the revision letter of the revision I want to
modify to my
routine. The routine then goes through the revision table until it finds a
match for
the revision letter passed to it. While stepping through the code everything
seems to
be working fine, no errors, but its obvious that the xrecord does not truly
update.
What am I doing wrong here? The routine is short so I have posted it in this
message.
Thanks for any tips
----------------------------------------------------------------------------
-----------
Sub UpdateRev(rev As Variant)
Dim ObjAcad As Object
Dim ObjDoc As Object
Set ObjAcad = GetObject(, "AutoCAD.Application")
Set ObjDoc = ObjAcad.ActiveDocument
Dim ObjDictionary As AcadDictionary
Dim ObjRevisions As AcadDictionary
Dim Xtyp, XVar As Variant
Dim XR As AcadXRecord
Dim i As Integer
On Error Resume Next
'Get our main dictionary
Set ObjDictionary = ObjDoc.Dictionaries.Item("TBLOCKER")
If Err.Number = 0 Then
'Get our revisions dictionary
Set ObjRevisions = ObjDictionary.Item("REVISIONS")
If ObjRevisions Then
For i = 0 To ObjRevisions.Count - 1
Set XR = ObjRevisions.Item(i)
XR.GetXRecordData Xtyp, XVar
If XVar(0) = rev(0) Then
'then update our revision xrecord
Xtyp(0) = 300: XVar(0) = rev(0)
Xtyp(1) = 301: XVar(1) = rev(1)
Xtyp(2) = 302: XVar(2) = rev(2)
Xtyp(3) = 303: XVar(3) = rev(3)
Xtyp(4) = 304: XVar(4) = rev(4)
Xtyp(5) = 305: XVar(5) = rev(5)
XR.SetXRecordData XType, XVar
Exit For
End If
Next i
End If
End If
end sub
--
Perry Leets
Inovec Optimization and Control Systems
Eugene, Oregon