Author Topic: Persisting of routine variables  (Read 1711 times)

0 Members and 1 Guest are viewing this topic.

Chumplybum

  • Newt
  • Posts: 97
Persisting of routine variables
« on: March 15, 2009, 08:19:41 PM »
Hi all,

for a while now i've been trying to find the best way to persist routine variables within and across sessions of AutoCAD. I finally settled on inheriting from 'Configuration.ApplicationSettingsBase' and saving the variables at the end of the routine, which has been working fine. However, i'm currently writing a routine that creates a few custom object snaps and have 2 different interfaces to the 'COSMODE' property:
1. is the command line routine
2. is a new tab placed in the Drafting Settings Dialog

the problem is that the property set using the command line is different to the one set using the dialog, although (and this is probably the wrong assumption on my part) they use the same property to set and get the value.

i thought that perhaps one version of the routine was being executed from the document context and one from the application context, but after adding the 'CommandFlags.Session' attribute i still get different values

is there a better way to persist routine variables (registry?, xml?) or a way to solve this problem???

any help would be great


Cheers, Mark

PS. i've attached my working solution to try and demonstrate this

Chumplybum

  • Newt
  • Posts: 97
Re: Persisting of routine variables
« Reply #1 on: March 18, 2009, 06:43:00 PM »
finally figured it out... all that was need was a 'me.reload' before the editor.getinteger or tab is added to the drafting settings
dialog

cheers, Mark

Glenn R

  • Guest
Re: Persisting of routine variables
« Reply #2 on: March 19, 2009, 12:22:50 PM »
I would serialise/de-serialise to XML which in turns hydrates a class object. Proggy starts and de-serialise XML to hydrate class object. Whilst proggy running, pass class object around wherever you need it. Proggy closes/shuts down/user hits save settings or whatever, serialise class object out to disk.