AutoLISP: Method of giving elevation symbols in AutoCAD
Print This Post
![]() |
Author | Muharrem Koçyiğit |
| Profession | Mechanical Technician | |
| AutoCAD & Prosteel Specialist | ||
| Location | Germany | |
AutoCAD 2007 and higher versions
Hello Daily AutoCAD readers,
Today, I would like to present you a tool that you can use during architectural project preparation. You have to give all of the major elevations for floor levels in all of the plan and section views. While doing this job, it is wiser to work with a “self-updating elevation” block that is appropriate according to standard elevation representations.
In this article, you will learn how to add automatically text (FIELD) property to a dynamic block that has multi view property and attribute. You can add FIELD property very easily by using an AutoLISP program.
In architectural discipline, elevation of sidewalk that is at the entrance of the building is accepted as 0.00 level. However, in AutoCAD, all of the elevations are calculated according to ground coordinate system! (wcs = world coordinate system).

Fig. 1 - Determining the value of point that is selected by using ID command.
Fig. 1 - (A): You can see the position where UCS icon is located as 0,0,0 as origin point. If you cannot see it, then you can set the UCSICON system variable to 1 or 3.
Fig. 1 - (B): It is possible to learn the value of any coordinate inside the drawing space by using ID command. For example, you can learn the insertion point of block by using this method.
Command: _ID (select the insertion point of block that is shown by letter (B))
Specify point: X = 1700.0000 Y = 2690.0000 Z = 0.0000
Dynamic block that is named as “Dyn-LEVEL-TR” has attribute property (variable text). This block that is prepared according to DIN 1356 (07.1974) norm has multiple view property.

Fig. 2 - Properties of dynamic block
Filled triangles (hatched with SOLID) is used in draft floor slab, whereas empty triangles are used in completed floor slabs. If you would like to dimension ceilings, then you have to mirror the block by using FLIP option.
If the elevation is pointing a position that is above the 0,0,0 reference point, (+) mark is placed in front of the value; whereas if it is below the reference point 0,0,0, then a (-) sign is placed in front of the value.
If the elevation is 0 (zero), then the value is written as ±0.000. The prefix ± (plus minus) is written by entering %%P.
You can change the value of attribute by using ATTEDIT or DDATTE commands. You can also do this by making double-clicking. If double-clicking is not working, then you can activate by using DBLCLKEDIT.

Fig. 3 - Changing attribute value of the block
It is possible to change the other values of blocks that has attribute property as you like (Fig. 4).
Another thing that I really like is that you can change the insertion point of attribute text to another position by using GRIP.

Fig. 4 - Editing the variable text properties of block.
| Dynamic block that has multiple view property (Parameter = VISIBILITY). |
![]() |
![]() |
![]() |
|||
| View mode: Y1 FLIP mode: Not flipped |
View mode: Y1 FLIP mode: Flipped |
View Mode: Z1 | |||
![]() |
![]() |
![]() |
|||
| View Mode: Y3 FLIP mode: Not flipped |
View Mode: Y3 FLIP mode: Flipped |
View Mode: Z2 | |||
![]() |
![]() |
![]() |
|||
| View Mode: Y5 FLIP mode: Not flipped |
View Mode: Y5 FLIP mode: Flipped |
View Mode: Z3 | |||
![]() |
![]() |
![]() |
|||
| View Mode: Y7 FLIP mode: Not flipped |
View Mode: Y7 FLIP mode: Flipped |
View Mode: Z4 |
For view and sections, you can use options that start with “Yx” letter (From Y1 to Y8). There are also some other symbols that are named from Z1 to Z4 which you can use for your plan drawings. AutoLISP program that is shown as list below filters the visibility parameter of the block and selects the Y- or Z- value that belongs to insertion point of the block.
Using the attached AutoLISP program that is given. Unit mode (%lu = linear units):
Unit mode settings that is very similar to system variable LUNITS are used by using these information.
\f “%.30q0″It shows according to unit system that is currently set.
\f “%lu1″ Unit system according to scientific operations.
\f “%lu2″ Decimal unit system.
\f “%lu3″ Engineering unit system.
\f “%lu4″ Architectural unit system.
\f “%lu5″ Raitonal unit system.
Number of decimals (%pr = precision):
It determines the number of decimal digits after comma. It is similar to system variable LUPREC and determines the precision of decimal digits. You can use the number of digits between 0 (zero) and 8.
\f “%pr0″ Numbers are shown as rounded without any commas.
\f “%pr8″ Number of digits after comma is shown as 8 (AutoCAD does not accept more then this).
Symbol that separates the directories (%ls = line separator): You can change the look of symbol that separates the directories from each other. It is possible to use another symbol instead of comma [,] which is designated by 44 as its Ascii value.
\f “%ls59″ [;] ASCII value 59
\f “%ls47″ [/] ASCII value 47
Symbol that separates the decimal part (%ds = decimal separator): It changes the look of symbol that separates decimal part of numbers. It is possible to use another symbol instead of comma [,] which is designated by 44 as its Ascii value.
\f “%ds44″ [\f “%ds32″ [] Space character ASCII value of which is 32.
Prefix of suffixes (%lu = prefix / suffix):
\f “%ps[Grid spacing = ,]” Then, “Grid spacing” will be used as prefix.
\f “%ps[Circle diameter = , mm]” “Circle diameter =” will be used as prefix, and “mm” will be used as suffix.
It is an easy way to get rid of zeros: (%zs = zero space)
\f “%zs1″ Feet settings
\f “%zs2″ Inch settings
\f “%zs4″ Removes the zeros before decimal separator
\f “%zs8″ Removes the unnecessary zeros after decimal separator
\f “%zs12″ Removes the zeros before and after decimal separator
Important notes:
All drawings that are made in model space must be made by M=1:1 scale and elevations must be equal to Y-value of coordinates. Print-outs (where the details are shown) are made in layout part (paper space). While editing the variable texts by using ATTEDIT command, you can edit the automatic texts by using the short-cut menu that appears by pressing right mouse button.
Attached files : Level.lsp, Level.dwg, Level-Sample.dwg
Technorati Tags: AutoCAD, elevation symbols, annotation
Read in other languages: TR
Similar Posts
Rate this article:














November 1st, 2007 19:35
Dear Mr. Kocyigit,
Thank you for you articles. I am very-very interested.
I am from Indonesia, and new user of autocad.
I work at infrastructure company.
There is no enough place for autocad user to learn autocad good.
Mr. Kocyigit….
I have many file of LSP (written in .txt (notepad) file.
My boss said that I can use them to design, draw, and calculate in autocad. But i can use it at all. I really don’t understand.
I need you help to used them. Because I really don’t know.
Thank you.
regards,
Anggi
November 8th, 2007 17:26
Mr. Kocyigit.
I have so meny time triying to use Lisp but I don know how start.
can you tell me were I can find.
thank you.
Fausto
November 12th, 2007 10:13
Dear Mr. Muharrem Kocyigit,
Thank you very much for this Lisp. Simply I loved it because I can use it in Plan View. I am using ACA2008 and there is Automatic Elevation but in Front View).
I have put Dynamic Block in my Design Center->drag it to the drawing (level +-0,00 is moved to coordinate 0,0,0 of World UCS, moving origin to zero level does not work) ; copy to neccesary levels; issue command from my tool in Tool Palette
^C^C(load “Level_cm.lsp”);AF2LB for level in cm or
^C^C(load “Level_m.lsp”);AF2LB for level in m, select all levels and it works perfectly and looks fine.
Thank you again,
regards,
Bosko
November 21st, 2007 23:09
Hi Anggi,
Sorry about the belated reply,
We would you help. Please send your lisp file to orhan @ taliasoft . com .
Thank you for your visit
November 21st, 2007 23:20
Hi Fasovi,
“AutoCAD Developer’s Guide to Visual LISP” is a good book (Author Nikolai Poleschuk)
URL: http://www.amazon.de/AutoCAD-Developers-Guide-Visual-LISP/dp/1584500913/
Thank you for your visit
November 21st, 2007 23:37
Hi Bosko,
please send your problem (drawing with lisp) to orhan @ taliasoft.com . I will verify the trouble.
Thank you
January 11th, 2008 17:17
Would it be possible to have this work with 2005?
Chris
January 13th, 2008 19:38
Hi Chris,
Dynamic block is only possible in AutoCAD 2006
March 14th, 2008 13:28
Hi,
How do you set up reference zero level?
March 25th, 2008 13:33
Hey! give some nice websites to download the Mechanical, Electrical and Plumping Designs and Sections, Elevations, Plans etc…… k.
May 26th, 2008 09:27
hi
Can u pl send one lisp,which can take the x value also,means offset and elevation at the same time.
I am using Autocad2004
kind regards
Sandy
June 28th, 2008 10:34
hi,
I is good but how i could use first level on 0.0
thanks