A simple AutoLISP application for constructing center lines.
Print This Post
![]() |
Author | Erhan Toker |
| Profession | Architect M.Sc. | |
| Autodesk Authorized Consultant | ||
| Software Specialist | ||
All of us suffer clogging while drawing a center lines that is made up of only two lines. Because, the hard part is not to draw those two lines, but to attach one over another in the middle. Most of the time, we draw the second line outside and move the first one by holding from its midpoint onto the second one. Second difficult thing is that second line must have the same length as the first one. Thus, in this article, I will explain how to do this in a practical way and also we will see a AutoLISP application that works with the same principle.

Fig. 1.
First of all, let’s take a look at MIRROR command, which is very practical:
Command : MIRROR( Let’s choose the vertical line )
Select objects: 1 found
Specify first point of mirror line:( Fig. 2 )

Fig. 2.
Specify second point of mirror line: @10<45( Fig. 3 )

Fig. 3.
Erase source objects? [Yes/No] :( press ENTER )
If we show the mirror line as 45° as shown in Fig.3, then we make a copy so that two lines have 90° between each other. This is the most practical way you can do this in AutoCAD (Except CENTERLINE in DIM command ). Of course, we can do this much more practical. By using the AutoLISP example, I am just about to show, on the condition to work only with the lines, we can create a set of axis by just one click. AutoLISP code is given in Fig. 4. Readers of AutoLISP pages can include their own modifications by following the comments.

Fig. 4 - AutoLISP code for drawing centerlines.
Write this code yourself or download centerlines.lsp from our download page and load. Then enter “clines” from command line. Program will ask you to select a LINE and wait until you select a LINE or pressing ESC. Hope you like this utility. Bye…
Similar Posts
Rate this article:


March 20th, 2007 15:28
I just draw the first center line then make a copy of itself by copy-select midpoint-and the type in @0,0 enter. Then select the line and the center grip. Go to the rotate command.Type in 90 degrees and enter.
this rotates the “top” line. then you have two line the same length attached at the center!
Richard
March 21st, 2007 23:51
The way that Richard has suggested works and was my first guess but as i am just a rookie and need all the help i can get with autolisp i thank you immeasurably Erhan.
Rick
March 22nd, 2007 10:36
Richard,
Thanks for comment. Your method is OK. We’re just trying to explain LISP infrastructure. I’m sure that CLINES command defined in this rouitne is the shortest way to do it.
April 24th, 2007 13:56
would you send vlisp lessons to my email.
I’m very intrested to these lessons.
thank you very much.
April 26th, 2007 23:41
I only use this:
(DEFUN C:CLINES () (COMMAND “MIRROR” PAUSE “” “MID” “@” “@10
April 26th, 2007 23:48
why can’t i show the rest of the code: angle sign 45″ “”))