Sunday, December 28, 2014

AutoLISP Tutorial for AutoCAD Users: Lesson 3

It's not all that comforting to know how to define a custom command if you can't save it and use it tomorrow or next year. Let's save our work.

File it

The way to save your AutoLISP work is to keep it in an AutoLISP Application Source (lsp) or sometimes an AutoLISP Menu Source (mnl) file.

If you are a programmer or an experienced computer user, you already have your own system for text file editing and management. If not, this is a great time to learn. We will file the AutoLISP program on your Windows Desktop.

Type this at the AutoCAD command line:

Press [Enter] again instead of supplying a file name.

The Windows Notepad file editor will open.

Select the File, Save As... menu

The Save As form will open:

Browse to the Windows Desktop:

Type l0.lsp in the "File name:" area

Click the Save button.

Type the (c:l0) function into the Notepad window:

Save and Exit Notepad.

That was easy if you've done it before. Sorry it was so hard if you haven't. There is no easier way.

Load it

To use your AutoLISP program, you have to load it into AutoCAD. Show the Desktop or browse to the Desktop in Windows Explorer. Then drag l0.lsp to the AutoCAD drawing area. If the AutoCAD drawing area isn't visible, drag l0.lsp onto the AutoCAD program on the Windows Taskbar, hold a second or two, then drag it into the AutoCAD drawing area when AutoCAD appears.


No comments: