Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Call AM commands via LISP

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
jseefdrumr
545 Views, 7 Replies

Call AM commands via LISP

I've been using the same .lsp file for years to set my command macros. It's old-school, but I like it. I've carried this file across several types of jobs. I am now at a new job using Mechanical 2013. I would like to add a couple of the AM commands to my macros, but they won't work.

 

Example of one that works:

(defun C:D ( ) (command "DIST"))

 

A mechanical command that won't:

(defun C:SA ( ) (command "AMSCAREA"))

 

I have tried prefixing the command with underscore, period, hyphen, etc and still no dice. Does anyone know a way to call AM commands via LISP?

 

Thanks for any help



Jim Seefeldt
Electrical Engineering Technician


7 REPLIES 7
Message 2 of 8
hmsilva
in reply to: jseefdrumr

I'm not a AM user,

just a try

 

(AMSCAREA)

or

(c:AMSCAREA)

 

Henrique

EESignature

Message 3 of 8
jseefdrumr
in reply to: hmsilva

Thanks for the reply. Sadly, it didn't work.

 

Any other suggestions out there?



Jim Seefeldt
Electrical Engineering Technician


Message 4 of 8
hmsilva
in reply to: jseefdrumr

jseefdrumr,

another attempt


using the ActiveX SendCommand method

 

(vl-load-com)

 

(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) (strcat "AMSCAREA"))

 

Henrique

EESignature

Message 5 of 8
kefer_kb
in reply to: jseefdrumr

Try this:

(defun c:amtest ()
  (c:amscarea)
)

kind regards,

Franz

www.gfm.at
Message 6 of 8


@jseefdrumr wrote:

I've been using the same .lsp file for years to set my command macros. It's old-school, but I like it. I've carried this file across several types of jobs. I am now at a new job using Mechanical 2013. I would like to add a couple of the AM commands to my macros, but they won't work.

 

Example of one that works:

(defun C:D ( ) (command "DIST"))

 

A mechanical command that won't:

(defun C:SA ( ) (command "AMSCAREA"))

 

I have tried prefixing the command with underscore, period, hyphen, etc and still no dice. Does anyone know a way to call AM commands via LISP?

 

Thanks for any help


The documentation doesn't mention this, but on a few tests seems to me that the command and vl-cmdf functions only work for vanilla AutoCAD built-in commands and some but not all AutoCAD Mechanical commands.

- and none of my own commands created by (defun c:something ()...)

 

So, they probably just forgot adding the AMSCAREA command to the system.

 

 

The suggestion by kefer.kb works for me on AcadM 2012.

 

--

 

Message 7 of 8
jseefdrumr
in reply to: kefer_kb

Thanks very much to Franz and Henrique. Using the (c:amscarea) method worked. Henrique suggested it originally, but I coded it incorrectly. Franz's post showed me the error I made that I overlooked. I am now up and rolling with my newly-macro'd AM commands. You guys rock! 



Jim Seefeldt
Electrical Engineering Technician


Message 8 of 8
hmsilva
in reply to: jseefdrumr

 
jseefdrumr,
 

glad I could help.

 

Henrique

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost