ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to call AutoLisp functions in Arx?

12 REPLIES 12
Reply
Message 1 of 13
killerxia
1076 Views, 12 Replies

How to call AutoLisp functions in Arx?

Hi, everyone, is it possible to call an autolisp function in Arx program?
I've tried acedCommand() and acedInvoke(), but they don't work, and the online help also says that they can't. I'm eager to know if this is possilbe, and if it is, how?

Anyone help me?
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: killerxia

Hello

 

I think your out of luck! I have heard of going
from AutoLISP to ObjectARX but not the other way around, how come you want to do
this when ObjectARX is vastly superior in every respect?

 

Cheers

Charles McAuley

Developer Consulting Group - Autodesk


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,
everyone, is it possible to call an autolisp function in Arx program?
I've
tried acedCommand() and acedInvoke(), but they don't work, and the online help
also says that they can't. I'm eager to know if this is possilbe, and if it
is, how?

Anyone help me?

Message 3 of 13
killerxia
in reply to: killerxia

I'm deeply upset receiving your reply, especiallly that it's from Autodesk! I want to call Autolisp functions in Arx just because the function is written by another developer who can use only Autolisp.

Thank you.
Message 4 of 13
Anonymous
in reply to: killerxia

Use the C command 'sendmessage' see the
sample...

 

CString msg = "ThelispCommand " ; // dont forget
the end space it's the enter !

 

 COPYDATASTRUCT msg2;
 msg2.dwData =
(DWORD)1;
 msg2.cbData = (DWORD)_tcslen(msg) + 1;
 msg2.lpData =
msg.GetBuffer(msg.GetLength()+1) ;

 

  SendMessage(adsw_acadMainWnd(),
WM_COPYDATA, (WPARAM)adsw_acadMainWnd(), (LPARAM)&msg2) ;


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I'm
deeply upset receiving your reply, especiallly that it's from Autodesk! I want
to call Autolisp functions in Arx just because the function is written by
another developer who can use only Autolisp.

Thank you.

Message 5 of 13
Anonymous
in reply to: killerxia


Hi, killerxia

 

 I'm an beginner in Arx programming, and I've
the same problem. After many hour's of reading Help files, experiment with
acedCommand() and so on, I've tried and succeed with AutoCad command
"script":

   

    acedCommand(RTSTR, "SCRIPT",
RTSTR, "Myfile.scr", 0);

 

 In "Myfile.scr" I wrote AutoLisp
command  I wonted  to execute.

 

Hope this helps.


 

Rusomir Drobac



style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
Hi,
everyone, is it possible to call an autolisp function in Arx program?
I've
tried acedCommand() and acedInvoke(), but they don't work, and the online help
also says that they can't. I'm eager to know if this is possilbe, and if it
is, how?

Anyone help me?

Message 6 of 13
Anonymous
in reply to: killerxia

Killerxia,

 

Take a look at the thread called "LISP X ARX" dated
from 06/11/2001 and you will find some interesting information about
this.

 

Regards,

Fernando.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,
everyone, is it possible to call an autolisp function in Arx program?
I've
tried acedCommand() and acedInvoke(), but they don't work, and the online help
also says that they can't. I'm eager to know if this is possilbe, and if it
is, how?

Anyone help me?

Message 7 of 13
Anonymous
in reply to: killerxia

Here's a macro:

#define Command(cmd, echo)
acDocManager->sendStringToExecute(acDocManager->mdiActiveDocument(), cmd, false,
true, echo)

Command("_.SCRIPT\nMyFiles.scr", true);

killerxia wrote:
>
> Hi, everyone, is it possible to call an autolisp function in Arx program?
> I've tried acedCommand() and acedInvoke(), but they don't work, and the online
> help also says that they can't. I'm eager to know if this is possilbe, and if
> it is, how?
>
> Anyone help me?

--
|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
| Autodesk Registered Developer
| email: byron@cadwerx.net
| web site: http://www.cadwerx.net
|
Message 8 of 13
Anonymous
in reply to: killerxia

Hi killerxia,
If you really mean Autolisp (not VLisp) then Charles is right.
Otherwise (R2000 and above), it can be done.
Do not use Send message or string, (you want to call Lisp then back to Arx
in the same flow)

killerxia wrote in message
news:f09d2ac.1@WebX.maYIadrTaRb...
> I'm deeply upset receiving your reply, especiallly that it's from
Autodesk! I want to call Autolisp functions in Arx just because the function
is written by another developer who can use only Autolisp.
> Thank you.
>
>
Message 9 of 13
Anonymous
in reply to: killerxia

> Hi, everyone, is it possible to call an autolisp function in Arx program?
> I've tried acedCommand() and acedInvoke(), but they don't work, and the
online help also says that they can't. I'm eager to know if this is
possilbe, and if it is, how?

The LISP code you call with this may not call (command) or
use the command line in any other way (AutoCAD 2000 or later
only):

int LispEvalStr(const char* LispExpr, resbuf** result)
{
if( acDocManager->documentCount() == 0 )
return RTFAIL;
struct resbuf *args, *args1;
args = acutNewRb(RTSTR);
args1 = acutNewRb(RTSTR);
args->rbnext = args1;
args1->rbnext = NULL;
acutNewString("veval-str+", args->resval.rstring);
acutNewString(LispExpr, args1->resval.rstring);
args1->rbnext = NULL;
int stat = acedInvoke(args, result);
acutRelRb(args);
return stat;
}
Message 10 of 13
killerxia
in reply to: killerxia

Thank you all for the answers, and I've learned much from your good idea. But I want to call a "function" not just a "command" of Autolisp(or Visuallisp, I know very little about lisp, so I don't know their difference at this very point), that is, there are some parameters to be transfered to it, I think it should be somewhat a resbuf list. Maybe It's a mission impossible. So, I've prepared to rewrite the code in ObjectArx.

Xia
Message 11 of 13
Anonymous
in reply to: killerxia

You can use acedPostCommand() function
:

acedPostCommand("(progn (command \"_LINE\" (list 0 0) (list 100 100)
\"\") (princ)) ");
acedPostCommand("(some_function)
");

Vinicius



style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
Hi,
everyone, is it possible to call an autolisp function in Arx program?
I've
tried acedCommand() and acedInvoke(), but they don't work, and the online help
also says that they can't. I'm eager to know if this is possilbe, and if it
is, how?

Anyone help me?

Message 12 of 13
Anonymous
in reply to: killerxia

You can call a LISP function and pass it
arguments in a resbuf list using acedInvoke(),
but first you must ensure the LISP function
is registered. You can register a LISP function
using this along with the code in my previous
post:

int RegLispFunc(const char* funcname)
{
char buf[128] = "";
sprintf(buf, "(vl-acad-defun '%s)", funcname);
resbuf* rb = NULL;
int stat = LispEvalStr(buf, &rb); // see previous post
if( rb != NULL )
acutRelRb(rb);
return stat;
}

After using the above, you can then use acedInvoke()
directly to call the LISP function, and pass it arguments
in a resbuf list.

"killerxia" wrote in message
news:f09d2ac.8@WebX.maYIadrTaRb...
> Thank you all for the answers, and I've learned much from your good idea.
But I want to call a "function" not just a "command" of Autolisp(or
Visuallisp, I know very little about lisp, so I don't know their difference
at this very point), that is, there are some parameters to be transfered to
it, I think it should be somewhat a resbuf list. Maybe It's a mission
impossible. So, I've prepared to rewrite the code in ObjectArx.
> Xia
>
>
Message 13 of 13
killerxia
in reply to: killerxia

Hi, Tony, this really works! Thank you!

Xia

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost