Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
New Member
miroslav.karpis
Posts: 1
Registered: ‎01-11-2013
Message 1 of 3 (185 Views)

starting autocad/acad with extra attributes (from command prompt)

185 Views, 2 Replies
01-11-2013 09:22 AM

Hi, please what are the attributes I can pass when I open acad from command prompt? Basically I would like to open AutoCad from command line with a lisp program as a parameter. After the acad is open the lisp program should be loaded and executed. Everyting automatic, without user-input.

 

Is that possible?

 

Thanks,..... 

*Expert Elite*
Kent1Cooper
Posts: 5,615
Registered: ‎09-13-2004
Message 2 of 3 (173 Views)

Re: starting autocad/acad with extra attributes (from command prompt)

01-11-2013 11:31 AM in reply to: miroslav.karpis

miroslav.karpis wrote:

... I would like to open AutoCad from command line with a lisp program as a parameter. After the acad is open the lisp program should be loaded and executed. Everyting automatic, without user-input.

 

Is that possible?

..... 


Look into the use of acad.lsp and/or acaddoc.lsp files.  Something that is loaded by the former will happen only when AutoCAD is first opened, and something that is loaded by the latter will happen in every drawing that is opened.  There are many examples on this forum [search for those file names].

 

Essentially, if the Lisp program you want to load and execute is called DoYourThing.lsp, you would have an entry in one of those files that looks like this:
 

(load "DoYourThing")

[You can include the .lsp at the end of the file name if you want, but it's not necessary.]

 

If the things that it does are just spelled out in DoYourThing.lsp, without the "wrapper" of a definition of a Command name to run them, then that's all you need to do -- they will be done when it loads.  If there is a definition of a Command in it that spells out what to do, for instance the top of it looks something like this:

 

(defun C:smileyfrustrated:etStandards (/ ...)

 

then after the (load) function in the acad.lsp or acaddoc.lsp file, you would need another line to run what's in that Command:

 

(C:smileyfrustrated:etStandards)

 

Or, you could put that last line into the end of the DoYourThing.lsp file, after the closing right parenthesis for the (defun) function, and it will "run itself" when it loads.

Kent Cooper
*Expert Elite*
M_Hensley
Posts: 1,722
Registered: ‎12-11-2003
Message 3 of 3 (145 Views)

Re: starting autocad/acad with extra attributes (from command prompt)

01-14-2013 05:36 AM in reply to: miroslav.karpis

You can use the command line switch /b to launch a script file. Just create a script that loads your lisp file.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.