ArcMap, storing a variable inside MxDocument?

445
4
Jump to solution
05-07-2014 01:28 PM
TonyE
by
New Contributor II
Is it possible to store a variable inside the MxDocument itself like you would for AutoCAD?  I ask because we want to create our own scale factor for a drawing/document that is set by the user and just our custom tools will use it.  I haven't really been able to find anything about there from searching online and it seems like something that would be very useful and used often.

If it is possible, does anyone have an example or a link to an example of this for me to go off?

Thanks for the help.
Reply
0 Kudos
1 Solution

Accepted Solutions
JeffMatson
Occasional Contributor III
Reply
0 Kudos
4 Replies
JeffMatson
Occasional Contributor III
Reply
0 Kudos
BondHarper
Occasional Contributor II
I don't know that you can store it in the Mxd, but I've used a txt file that prompts the user to update it through a custom script. Then other scripts can read the value from the txt file. I've also used tabular files as well when there are multiple variables.
Reply
0 Kudos
ThavitinaiduGulivindala
Occasional Contributor
you may add ITextElement that stores your info.
Reply
0 Kudos
DuncanHornby
MVP Frequent Contributor
There are lots of ways to approach this topic.

I believe Jeff's answer is the best way to store a value actually inside the MXD but I've often created code that reads and writes from a simple XML file. This would allow people to edit values outside the ArcMap environment but then you would need to either have a well known location to read/write or have it associated with the MXD in some way.

Alternatively write it into Excel and use automation to connect and read from the worksheet?

You could even try writing to the registry?
Reply
0 Kudos