Author Topic: Getting the value of a NON-system variable in C#  (Read 2023 times)

0 Members and 1 Guest are viewing this topic.

Binky

  • Guest
Getting the value of a NON-system variable in C#
« on: September 21, 2011, 01:00:12 PM »
As part of the startup routines, I set a handful of lisp varibles for use by various commands.  I am writing a C# command and I would like to read the vaule of one of the varibles that I set during startup.  All I have found anywhere are methods to retreive the value from System varibles but not NON-system

Try as I might I can seem to find a way.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Getting the value of a NON-system variable in C#
« Reply #1 on: September 21, 2011, 01:19:26 PM »
When you say "LISP variables" do you mean something like reading the value from (setq *global_var* "This is a string")?  If so, trying to get the two to talk to each other is more pain than its worth, IMO.  If you need to store data follow the lead of other applications: Dictionaries/XRecords, registry entries, or configuration files.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Binky

  • Guest
Re: Getting the value of a NON-system variable in C#
« Reply #2 on: September 21, 2011, 01:38:56 PM »
I have 3 different setups, Main office, Satellite office, and laptops.  As part of the start up I set three varibles that that have path information based on the which machine autocad is fired up from.  I set it via a simple (setq rootpath <Path>) and a couple others based on a test of which if any network is available at the time autocad was started.  Then any command that needs the path can simply splice together that value with anything else go on it's merry way.  Merry as long as it's lisp at least.

Just read your response again, short answer, yes.


Binky

  • Guest
Re: Getting the value of a NON-system variable in C#
« Reply #4 on: September 21, 2011, 06:30:40 PM »
Thanks Jeff, I'll take a look at that in a bit. 

Binky

  • Guest
Re: Getting the value of a NON-system variable in C#
« Reply #5 on: September 22, 2011, 12:40:11 PM »
Got it working, Thanks for the help.  I am self taught at this, if I may ask a quick question about this...

The following is a "Delegate"?  That chapter in the C# book I read was/is a bit fuzzy, but this seems like what they were getting after.

[DllImport("acad.exe", EntryPoint = "acedGetSym", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
extern static private int acedGetSym(string args, out IntPtr result);

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Getting the value of a NON-system variable in C#
« Reply #6 on: September 22, 2011, 01:14:50 PM »
Got it working, Thanks for the help.  I am self taught at this, if I may ask a quick question about this...

The following is a "Delegate"?  That chapter in the C# book I read was/is a bit fuzzy, but this seems like what they were getting after.

[DllImport("acad.exe", EntryPoint = "acedGetSym", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
extern static private int acedGetSym(string args, out IntPtr result);

Kerry did all the work,
 
For the DllImport
http://msdn.microsoft.com/en-us/library/aa984739(v=VS.71).aspx