Welcome to the Southern African Autolisp Website.

Afra-lISP


You are Visitor Number since 17th February 1999.


Home. Page II. Page III.

Into the Database - Page I

Hold onto your hat because we're going to dive straight in here.
Fire up AutoCad and draw a line anywhere on the screen.
Now type this then press Enter:

	(setq a (entlast))

Lisp should return something like this:

	<Entity name: 2680880>

This is the Entity Name of the Line that you have just drawn.
Now type "Erase" then !a and press Enter twice.
The line should disappear. Type "OOPS" to bring it back.
You have just modified the AutoCAD Database.

Now type this :

	(setq b (entget a))

This will retrieve the Entity Data. It should look something like this :

((-1 . <Entity name: 2680880>) (0 . "LINE") (5 . "270")
(100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") 
(10 400.378 621.82 0.0) (11 740.737 439.601 0.0) 
(210 0.0 0.0 1.0))

Now type this line:

	(setq c (cdr (assoc 10 b)))

Lisp should return:

	(400.378 621.82 0.0)

Before you type the next few lines, make sure that your snap is
turned off.

Command: circle
3P/2P/TTR/<Center point>: !c
Diameter/<Radius> <10.0>: 20

A circle should be drawn at the end of the line.


This exercise was just to show you the ability of AutoLisp to go behind
your drawing, into the database, and manage graphic and non-graphic information.
This tutorial will show you how entities are stored and referenced in the database.
It will show you how AutoLisp reveals data about entities and how they can be
modified and manipulated. Say au revoir to your wife and kid's and let's visit
the AutoCad Database. (Star Trek theme music now starts......)

Home. Page II. Page III.


Copyright © 1999 by Kenny Ramage
All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage.