help with a lisp macro

help with a lisp macro

jseefdrumr
Mentor Mentor
702 Views
2 Replies
Message 1 of 3

help with a lisp macro

jseefdrumr
Mentor
Mentor

So I use old-school LISP for my command macros. Currently I'm trying to call the 'create new drawing' dialog. I can enter AENEWDRAWING directly on the command line and get it. But if I try to macro it to something else it won't work. Below is an example of the code I used, along with the simple variations I tried. NOTE: Command macros are literally the only thing I do in LISP, sorry if this is an easy one.

 

a line of good, working code:

(defun C:EN ( ) (c:AEPNEUMATIC))

 

what I think *should* work:

(defun C:ENEW ( ) (c:AENEWDRAWING))

 

other stuff I tried:

(defun C:ENEW ( ) (c:_AENEWDRAWING))

(defun C:ENEW ( ) (c:ACENEWDRAWING))

(defun C:ENEW ( ) (c:_ACENEWDRAWING))

(defun C:ENEW ( ) (command "_AENEWDRAWING"))

(defun C:ENEW ( ) (command "_ACENEWDRAWING"))

 

These all return either 'no function definition' or 'unknown command AENEWDRAWING', depending on how I tried to call the command. The last one on the list returns 'nil', which is confusing.

 

Thanks in advance

Jim



Jim Seefeldt
Electrical Engineering Technician


0 Likes
Accepted solutions (1)
703 Views
2 Replies
Replies (2)
Message 2 of 3

rhesusminus
Mentor
Mentor
Accepted solution
It's a little bit dirty, but it works:
(defun C:ENEW () (vla-SendCommand (vla-get-activedocument (vlax-get-acad-object)) (strcat "ACENEWDRAWING" " ")))

Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
0 Likes
Message 3 of 3

jseefdrumr
Mentor
Mentor

Works perfectly, many thanks Trond!

 

\m/

 

Jim



Jim Seefeldt
Electrical Engineering Technician


0 Likes