
So I changed the name to Zoom to Point (ZP). Because we will enable users to pick their own point, zoom to origin may not appropriate name anymore. We will add more functionalities so users can pick other point to zoom to. That program works, but it is very limited to zoom to 0,0,0 coordinate only.

Using AutoLISP Variable and Asking User Input NovemBy Edwin Prakoso 0 Comments and 0 Reactions We have started the AutoLISP tutorial by creating a very simple program: zoom to origin. Does it work? Congratulations! You have just created your first program! We will modify this program further. Now move to AutoCAD window, and try to type ZO then. Load and Run Your Program In visual LISP editor, click load active edit window. Adding (princ) will end the program gracefully, but without it, it will also work. This time, you can use (princ) or not using it. (defun c:ZO () (command “_ZOOM” “_C” “0,0″ “2000″) (princ) ) You know what’s written in red means right? Command will load internal AutoCAD command, then you give the parameters. Now in your Visual LISP editor, try to type like below. If you use imperial, you may want to change it to smaller number.Įach time we give the input, we press enter. It means AutoCAD will show 1000 to the left, and 1000 to the right. Type the distance you want to see on your screen. The last thing AutoCAD will ask is the magnification. Because we want to zoom to origin, we type 0,0. Then AutoCAD will ask us the center point. Then AutoCAD will ask us which method you want to use.

4.įirst, we type _zoom to activate the zoom tool. The red fonts are the command we input during the zoom process. Examine what we do when we use the command.Ĭommand: ‘_zoom Specify corner of window, enter a scale factor (nX or nXP), or : _c Specify center point: 0,0 Enter magnification or height : 2000 AutoCAD tool that can do this is zoom to center. This program will zoom to the drawing origin, no matter which part of drawing we currently see. Your First AutoLISP Program: Zoom to Origin We are going to create our very first program. We will do a simple exercise here, to see how it works. Inside the parenthesis, you define whatever you want AutoCAD to do. So make sure it will be EASY FOR YOU to find it. Most programming language will not care where is the close parenthesis, as long as they can find it. This will be easier for us to find the parenthesis pair. Most programmer will put the close parenthesis below, parallel to open parenthesis. AutoCAD will run your program when you type ZO then enter at command line. If you find this: (defun c:ZO ()) It means that we are defining ZO as a command. (defun c:YourProgramCommand () WhateverYouWantAutoCADtoDo (princ) )ĭefine a Function (defun ()) AutoLISP will start with (defun c:ProgramCommand ()). However, it has many specific AutoLISP programming tools that can help us.Ĭlick new or access file>new to create a new AutoLISP program.ĪutoLISP Structure Before we start, let us see the common program structure below.

AUTOCAD LISP UNKNOWN COMMAND WINDOWS
This window might not look fancy, and and the icons remind me of good old Windows 3.1 icons. You can access visual lisp editor from manage tab, applications panel.ĪutoCAD will open visual lisp window. Let us use visual lisp editor instead of notepad. There are many functionalities you can use here, more useful than notepad. However, AutoCAD itself has provided a Visual LISP editor. It is a plain text, you only have to save it with file extension. It’s an excellent resource!Ĭreating AutoLISP Application An AutoLISP program can be created in notepad. You can also refer to AfraLISP for more AutoLISP tutorial. So let us start to learn slowly, by creating simple program. If you are an AutoLISP guru, I will be happy if you correct any mistakes or if you suggest better solution. I’m not good with AutoLISP, but if you are interested to learn it with we, you can keep reading this tutorial. AutoLISP can also be useful to automate several process that usually need you use several tools, but with AutoLISP you may only need a few clicks. Many people use it to extend AutoCAD capabilities, do things that vanilla AutoCAD can’t. Your First AutoLISP Program: Zoom to Origin NovemBy Edwin Prakoso 2 Comments and 0 Reactions AutoLISP has been a popular customization for AutoCAD. You will be guided slowly to create your own AutoLISP program AutoLISP for Absolute Beginners Let us learn AutoLISP in plain English.
