Set/Get AutoLISP symbol

By Virupaksha Aithal
You can use “acedPutSym” API to set the AutoLISP symbol and “acedGetSym” API to retrieves the value of a AutoLISP symbol.

//set the MySymbol value
struct resbuf *rb = acutBuildList(RTSTR, 
                            _T("Unicode String"), RTNONE);
int res = acedPutSym(_T("MySymbol"), rb); 
acutRelRb(rb); 
 
//get back the text
rb = NULL; 
int  rc = acedGetSym(_T("MySymbol"), &rb); 
acutPrintf(L"MySymbol value is %sn", rb->resval.rstring);
acutRelRb(rb);

Comments

6 responses to “Set/Get AutoLISP symbol”

  1. What is the .net equivalent of acedGetSym ?

  2. What is the .net equivalent of acedGetSym ?
    I tried with the below code , but its giving error —- “Unable to find an entry point named ‘acedGetSym’ in DLL ‘acad.exe’.
    [System.Security.SuppressUnmanagedCodeSecurity]
    [DllImport(“acad.exe”, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = “acedGetSym”)]
    extern static private int acedGetSym(string args, out IntPtr result);
    static public ResultBuffer AcadGetSym(string varname, ref int stat)
    {
    IntPtr rb = IntPtr.Zero;
    stat = acedGetSym(varname, out rb);
    if (stat == (int)PromptStatus.OK && rb != IntPtr.Zero)
    return (ResultBuffer)DisposableWrapper.Create(typeof(ResultBuffer), rb, true);
    return null;
    }
    I am using AutoCAD 2014 and Visual Studio 2010 on windows 7 64 bit machine.

  3. Hi ,
    Please import the acedGetSym from accore.dll instead of acad.exe
    Thanks
    Viru

  4. aiyoung Avatar
    aiyoung

    Hello Virupaksha,
    Has the location of acedGetSym been changed for AutoCAD 2015, 32 bit?
    I get an error that acedGetSym cannot be found in acCore.dll when i run code that uses acedGetSym.
    The same code runs fine in 32 bit AutoCAD 2013 and 2014. The same code also runs correctly in 64-bit versions of AutoCAD 2013 to 2015.
    I’ve posted the same question to the AutoDesk forms and to theswamp.org, but i haven’t gotten any good replies.
    http://forums.autodesk.com/t5/NET/Issues-running-Net-code-that-uses-AcedGetSym-in-32-Bit-AutoCAD/td-p/5092498
    http://www.theswamp.org/index.php?PHPSESSID=vqc0sh722a4lumftn0bg2d2qf6&topic=47248.0
    I would appreciate any insights you might have on this issue.
    Thanks!

  5. x86: “_acedGetSym” or “?acedGetSym@@YAHPB_WPAPAUresbuf@@@Z”
    x64: “acedGetSym” or “?acedGetSym@@YAHPEB_WPEAPEAUresbuf@@@Z”

  6. Document.GetLispSymbol/SetLispSymbol

Leave a Reply to Subir Kumar DuttaCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading