(defun C:CHGTEXT ( / a ts n index b1 b2 b c d) As you will see, the onlyĭifference is, is that we have added a conditional filter to the routine. Height of text without affecting other entities. Listed below is another routine that allows you to globally change the Increases the 'index' variable by 1, priming it for the next loop. Updates the new entity list in the database. Substitutes the new 'd2' layer for the old 'd1' layer in the entity list 'a1', and assigns it to the new entity list 'b3'. This gets the entity list and assigns it to 'b1'. This begins the loop that pages through the selection set.
#Autocad lisp using entlast in a command code
This looks for the code 8 in the entity list 'a2', and then assigns the sub list to 'd2'. This statement retrieves the entity list from 'a2' and assigns it to 'b2'. Sets the loop control variable 'index' to zero. (setq n (sslength a1))Ĭounts the number of entities in the selection set 'a1' and stores this This is a special type of selection statement that only allows you to Prompts the user to select the Target Layer. (prompt "\nPoint to Entity on Target Layer : ") (prompt "\nSelect Entities to be Changed : ")Īllows the user to select the objects to be changed. (To test this routine, you will need toĬreate a drawing with objects on different layers.) Let's have a look lineīy line : (defun C:CHLAYER ( / a1 a2 n index b1 b2 b3 d1 d2)ĭefines the function and declares all variables as local. The target layer is choosen by simply pointing to an This routine allows you to select any number of objects and change them (prompt "\nSelect Entities to be Changed : ") Have a close lookĪt this coding : (defun C:CHLAYER ( / a1 a2 n index b1 b2 b3 d1 d2) Which you can apply to numerous, similar applications. Let's have a look at an AutoLisp routine that can be used, as a sort of But, although entity access and manipulation isįairly complex, it can be divided into component parts that make it much When you first start to delve into the AutoCAD database it is, IĪdmit, quite daunting. (Star Trek theme music now starts…) Into the Database - Part 2 It will show you how AutoLisp reveals data about entities and how they canīe modified and manipulated. This tutorial will show you how entities are stored and Your drawing, into the database, and manage graphic and non-graphic This exercise was just to show you the ability of AutoLisp to go behind Command: circleĪ circle should be drawn at the end of the line.
Now type this line: (setq c (cdr (assoc 10 b)))īefore you type the next few lines, make sure that your snap is turned off. It should look something like this: ((-1. You have just modified the AutoCAD Database.
Now type "Erase" then !a and press Enter twice. This is the Entity Name of the Line that you have just drawn. Now type this then press Enter: (setq a (entlast)) Hold onto your hat because we're going to dive straight in here.įire up AutoCad and draw a line anywhere on the screen. By Kenny Ramage Into the Database - Part 1