Author Topic: Local variables (for each drawing)  (Read 2665 times)

0 Members and 1 Guest are viewing this topic.

simor

  • Guest
Local variables (for each drawing)
« on: December 30, 2008, 10:03:08 AM »
Hi,

I'm trying to figure out if there is an easy way to have variables defined on a "per drawing" level. I thought that ThisDrawing will refer to the active drawing (in standalone project - not embedded) and so I will be able to use ThisDrawing.myvar and myvar defined under ThisDrawing as public but apparently once myvar is set under Drawing1.dwg I can see the same value when I'm working on Drawing2.dwg. (It's per project, not per dwg file).
I know I can use dictionaries but I thought that maybe there's some easier way, some keyword I can put next to the variable definition that will set the "per-file-scope".
uhmm am I clear?  :oops:

Bryco

  • Water Moccasin
  • Posts: 1882
Re: Local variables (for each drawing)
« Reply #1 on: December 30, 2008, 10:28:18 AM »
Thisdrawing, like you have said, is merely the active drawing.
Perhaps the easiest way to achieve what you want is to come up with some rules that work for your project, if this drawing path comes from here, do this etc.

simor

  • Guest
Re: Local variables (for each drawing)
« Reply #2 on: December 30, 2008, 02:13:41 PM »
Thanks Bryco. I was thinking of creating some array/table to store my per-dwg-data (new dwg = new record) but it's hard to believe autodesk/microsoft didn't prepare anything like that ... other than the dictionaries hmm. I'll have a closer look at them, maybe they aren't that scary - the implementation I have is really unclear :P

BTW, do you/anyone happen to know if this kind of variable scope is available when using ARX & .NET (C#)?

Bryco

  • Water Moccasin
  • Posts: 1882
Re: Local variables (for each drawing)
« Reply #3 on: December 30, 2008, 02:24:59 PM »
Perhaps you could use the User setvars available as integer useri1, real userr1 or the string version. These are per drawing and may be all you need.
Net doesn't have anything magical for this that I know of.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Local variables (for each drawing)
« Reply #4 on: January 03, 2009, 12:08:41 PM »
Why not just write a wrapper for dictionaries that provides an easy / simplified interface? User vars are not the way to go imo.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

simor

  • Guest
Re: Local variables (for each drawing)
« Reply #5 on: January 04, 2009, 08:33:44 AM »
I'm not a fan of the user vars either.. so I went the dictionary/xrecord direction and so far it's looking good. Thanks for the tips :)