Lista das lisps carregadas no AutoCAD

A muito tempo atrás, numa galáxia muito distante, houve uma discussão no finado, sobre como obter uma lista das lisps carregadas no autocad...

Bem, naquela época, cheguei a postar um pequeno programa em ObjectARX na página.

O programa era este aqui:

#if defined(_DEBUG) && !defined(AC_FULL_DEBUG)
#error _DEBUG should not be defined except in internal Adesk debug builds

#include "aced.h"
#include "tchar.h"
#include "acdocman.h"
#include "adslib.h"

#define ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))

struct func_entry
{ TCHAR *func_name; int (*func) (struct resbuf *); };

/* Here we declare the functions that handle the calls; */
int LoadedList (struct resbuf *rb);

/* Here we define the array of function names and handlers. */
static struct func_entry func_table[] = { {_T("LoadedLispList"), LoadedList},};

/* To add more functions to this table, just put them in the list, after
declaring the function names. Note that in standard C it's all right to
have a superfluous comma after the last item. */

/* Declarations of other local functions */
int dofun (void);
int funcload (void);

extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* appId)
 switch(msg) {
 case AcRx::kInitAppMsg:
 case AcRx::kInvkSubrMsg:
 case AcRx::kLoadDwgMsg:
  funcload(); }
 return AcRx::kRetOK;

static int funcload()
 int i;
    for (i = 0; i < ELEMENTS(func_table); i++)
  if (!acedDefun(func_table[i].func_name, (short)i))
   return RTERROR; }
 return RTNORM; }

/* DOFUN -- Execute external function (called upon an RQSUBR request).
Return value from the function executed, RTNORM or RTERROR. */

static int dofun()
 struct resbuf *rb;
 int val;
 /* Get the function code and check that it's within range. 
   (It can't fail to be, but paranoia doesn't hurt.) */
 if ((val = acedGetFunCode()) < 0 || val >= ELEMENTS(func_table)) {
  acdbFail(_T(/*MSG2*/"Received nonexistent function code."));
  return RTERROR; }
 /* Fetch the arguments, if any. */
 rb = acedGetArgs();

 /* Call the handler and return its success-failure status. */
 val = (*func_table[val].func)(rb);
 return val;

static int LoadedList(struct resbuf *rb)
 AcApDocument* ActiveDoc = acDocManager->curDocument();
 struct resbuf *resultlist, *rover;
 resultlist = rover = acutNewRb(RTLB);
 for (int i=0; iGetCountOfLispList(); i++)
  AcLispAppInfo* appInfo = ActiveDoc->GetItemOfLispList(i);
  if (appInfo)
   rover->rbnext = acutNewRb(RTSTR);
      rover = rover->rbnext;
      rover->resval.rstring = appInfo->appFileName; }}
 rover->rbnext = acutNewRb(RTLE);
 rover = rover->rbnext;
 rover->rbnext = NULL;
 return RTNORM;

Bom, se você quiser compilar, terá de baixar o Visual Studio e também o ObjectARX Cuidado para os pré requisitos das versões do ObjectARX.

Eu compilei aqui para o versão 2012 do AutoCAD (VS2010).

Para usar é simples:
Carregue o programa com o APPLOAD, e escolha a versão correta (32 ou 64 bits)

e você terá algo assim:

("C:\\program files\\autodesk\\autocad civil 3d 2012\\express\\acetutil.fas" 
"C:\\program files\\autodesk\\autocad civil 3d 2012\\express\\acetauto.LSP" 
"C:\\program files\\autodesk\\autocad civil 3d 2012\\express\\acettest.fas" 
"C:\\program files\\autodesk\\autocad civil 3d 2012\\support\\acad2012.LSP" 
"C:\\program files\\autodesk\\autocad civil 3d 2012\\support\\acad2012doc.LSP" 
Bacana, não?


Related Posts Plugin for WordPress, Blogger...