relysoft
2005-02-11, 08:36 PM
I think I am going in circles.
My objective is to trap calls to the CLOSEALL and QUIT commands in order to update some variable information stored with each drawing using LISP. This data is stored in a dictionary named "kcad" using keywords like "updates" and "initls". The function vlax-ldata-put was used to create the original entries in the dictionary.
Since CLOSEALL and QUIT operate on multiple drawings I could not use LISP for this. My first thought was to use VBA to call LISP functions I already had in place that are executed with single-drawing commands like "CLOSE". BUT... using the SendCommand method to run my LISP did not work because VBA and LISP execute asynchronously (thanks, Ed, for pointing that out). SO... you folks recommended that I do all the work in VBA. Well, I am stumped again. Below is some sample code I wrote (please don't laugh too loudly, I am new at this) that I believe gets me down to the object associated with the "updates" keyword in the "kcad" dictionary. At this point I have no clue how to access the variable data in this object. I looked at what I thought would be some examples, but I only got really confused. Can anyone help me from here? Of course I need to change/append data associated with these objects and put the revised data back into the dictionary.
Anyone willing to take a shot at this? If I am trying to do the impossible or unreasonable, please tell me so before I burn a lot more time on this!
Thanks,
Bob
Sub getkcad()
Dim okcad As AcadDictionary
Dim odict As AcadObject
Dim oentry As AcadObject
Set okcad = ThisDrawing.Dictionaries.Item("kcad")
MsgBox "KCAD object name: " & okcad.Name
MsgBox "KCAD object count: " & okcad.Count
Set oentry = okcad.Item("updates")
MsgBox "Made It to *updates* object in the dictionary"
End Sub
My objective is to trap calls to the CLOSEALL and QUIT commands in order to update some variable information stored with each drawing using LISP. This data is stored in a dictionary named "kcad" using keywords like "updates" and "initls". The function vlax-ldata-put was used to create the original entries in the dictionary.
Since CLOSEALL and QUIT operate on multiple drawings I could not use LISP for this. My first thought was to use VBA to call LISP functions I already had in place that are executed with single-drawing commands like "CLOSE". BUT... using the SendCommand method to run my LISP did not work because VBA and LISP execute asynchronously (thanks, Ed, for pointing that out). SO... you folks recommended that I do all the work in VBA. Well, I am stumped again. Below is some sample code I wrote (please don't laugh too loudly, I am new at this) that I believe gets me down to the object associated with the "updates" keyword in the "kcad" dictionary. At this point I have no clue how to access the variable data in this object. I looked at what I thought would be some examples, but I only got really confused. Can anyone help me from here? Of course I need to change/append data associated with these objects and put the revised data back into the dictionary.
Anyone willing to take a shot at this? If I am trying to do the impossible or unreasonable, please tell me so before I burn a lot more time on this!
Thanks,
Bob
Sub getkcad()
Dim okcad As AcadDictionary
Dim odict As AcadObject
Dim oentry As AcadObject
Set okcad = ThisDrawing.Dictionaries.Item("kcad")
MsgBox "KCAD object name: " & okcad.Name
MsgBox "KCAD object count: " & okcad.Count
Set oentry = okcad.Item("updates")
MsgBox "Made It to *updates* object in the dictionary"
End Sub