View Full Version : Accessing USERRx and USERIx variables
cyr_j
2007-11-09, 11:13 PM
How do you access the USERR and USERI variables in .NET? I've looked for documents on the internet and wasn't able to find any references. I'm also not sure where to look in the developer's help file to find it.
Thanks for your help.
Jason
Ed Jobe
2007-11-09, 11:50 PM
Check the sticky post at the top of this forum for some links.
dmarcotte4
2007-11-10, 07:34 AM
How do you access the USERR and USERI variables in .NET? I've looked for documents on the internet and wasn't able to find any references. I'm also not sure where to look in the developer's help file to find it.
Thanks for your help.
Jason
Jason, Have a look at this and see if this helps you. Also, there are some great .NET resources/programmers over at the http://www.theswamp.org/ as well.
using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
[assembly: CommandClass(typeof(GetUserVars.Commands))]
namespace GetUserVars
{
public class Commands
{
public Commands()
{
}
[CommandMethod("GetUserVar")]
static public void GetUserVar()
{
Editor MyEditor = Application.DocumentManager.MdiActiveDocument.Editor;
PromptResult Result = MyEditor.GetString("\nEnter a user Variable");
if (Result.Status == PromptStatus.OK)
{
try
{
//Get the user variable
object uservar = Application.GetSystemVariable(Result.StringResult);
MyEditor.WriteMessage("\nUser Variable {0}, is typeof {1}, value of {2}"
,Result.StringResult.ToUpper() ,uservar.GetType(), uservar);
}
catch(System.Exception ex)
{
MyEditor.WriteMessage(ex.Message);
}
}
}
}
}
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.