This is an interesting and highly useful feature comes with the Autodesk
AutoCAD. Unfortunately the LT version is not packed with this. But the
full version is.
Every entity you draw in AutoCAD, whether it is a point or a piece of a line or a block, is unique with a bunch of details associated with it and the details are well populated in the form of a list. Now, this details from the list, can be extracted and manipulated in any way we like it to, with the help of a set of functions. That is it, basically in a nutshell. LISt -Processing - that's how the name came.
Let's see an example. Every entity you draw in AutoCAD, whether it is a point or a piece of a line or a block, is unique with a bunch of details associated with it and the details are well populated in the form of a list. Now, this details from the list, can be extracted and manipulated in any way we like it to, with the help of a set of functions. That is it, basically in a nutshell. LISt -Processing - that's how the name came.
1. Make a line
2. We are going to see one tiny little function to extract the unique entity name of the line entity we just drawn. Type in the following command
'(entlast)' . Please note that, you have entered in between parentheses. This is something you may want to remember. Because, simply typing in the command 'entlast' it will say "Unknown command "ENTLAST". Press F1 for help.".
So when you type correctly '(entlast)', it will return the unique entity name, for example, like this,
Command: (entlast)
<Entity name: 7ffffb05820>
3. Now, another tiny little function is '(entlast)' and its input is a valid entity name.
Type in '(entget(entlast))' , this will automatically input the name of the last entity and will display its properties and parameters in a list.
Command: (entget(entlast))
((-1 . <Entity name: 7ffffb05820>) (0 . "LINE") (330 . <Entity name:
7ffffb039f0>) (5 . "1F2") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
"0") (100 . "AcDbLine") (10 1288.67 1455.3 0.0) (11 1643.82 1250.26 0.0) (210
0.0 0.0 1.0))
Wow, a lot of information like, its type, name, layer, coordinates of its end points and much more. Knowing about what specifically each one is will help in manipulating it in any required way.
Now, we can make use of the available functions in AutoLisp and write some blocks of code in the dedicated Visual Lisp editor under Tools/AutoLISP/Visual LISP Editor
Stay tuned for more about how to work with it.
Comments
Post a Comment