![]() ![]() ![]() AutoLisp should return something like this: Select object: ((-1. Now type this : (setq e (entget (car (nentsel)))) Now, while we're here, let's have a quick look at blocks… BlocksĬreate a block consisting of a couple of lines and a circle with a radius of 20. (setq e (entget (car (nentsel))))ĪutoLisp should return something like this : Type this, then select any vertex of a polyline. The function (nentsel) let's you select an entity and returns the name of the entity even if it belongs to a polyline. ![]() There is a quicker way of retrieving the entity list of a Polyline vertex. (setq e (entget (entnext (cdr (car e))))) while loop control is not nil, carry on looping Here's an example of a function that will print the coordinates for each vertex of a Polyline : (defun c:coord ( / e r) We just need to loop through the sequence of vertices until we reach the SEQEND list. To extract the entitity list for each vertex is therefore, quite easy. Take note of the entity type of each variable :ĭo you see that a 3 line Polyline consists of a master or, parent list, 4 vertex and an end-of sequence ( "SEQEND") list. Each code segment then uses the (entnext entity name) of the entity that precedes it. The (cdr (car e)) returns the entity name of entity list e. "AcDbEntity")Ĭommand: (setq e5 (entget (entnext (cdr (car e4))))) 32)Ĭommand: (setq e4 (entget (entnext (cdr (car e3))))) 32)Ĭommand: (setq e3 (entget (entnext (cdr (car e2))))) 0))Ĭommand: (setq e2 (entget (entnext (cdr (car e1))))) Now type the following 5 code segments : Command: (setq e1 (entget (entnext (cdr (car e))))) This is where the (entnext) function comes into play. Hey, wait a minute!… AutoLisp has returned the entity list, and I can see that it's a Polyline, but there are no co-ordinates, and where does AutoLisp get the co-ordinates for all the vertices?Īs I said earlier, we need to dig a little bit deeper to get the information we require. Then type this : Command: (setq e (entget (car (entsel))))ĪutoLisp should return something like this : Select object: ((-1. We will have a look at the R13 and below Polyline first. When a drawing from a previous release is opened in Release 14 and above, all 2D polylines convert to lwpolylines automatically unless they have been curved or fitted or contain xdata. 2D polylines are created as lwpolyline entities by default unless they have been curved or fitted with the PEDIT command. In Release 14 and above, 3D polylines are always created as standard polyline entities. Lwpolylines display faster and consume less disk space and RAM. This is different than a standard polyline, which is defined as a group of subentities. A lwpolyline is defined in the drawing database as a single graphic entity. The LwPolyline (Light Weight Polyline) entity, or "optimized polyline," was introduced with Release 14. So bear with me, take your time, and hang on for a ride on the magic carpet… Polylines In fact, once we get there I'll show you a couple of things that you swear is magic. I know that they are called "complex entities", but the only difference between them and other entities is that we just have to dig a bit deeper to get to what we want. Honestly, they are a lot easier to deal with than you think. Developed using OpenGL and optimized vector algorithms for fast startup and run.Polylines and Blocks! Come back… Don't run away… LISP programming enabled by installing free LISP Extension for BabaCAD. Users/Developers can develop their own extension modules using BabaCAD API. Custom LISP toolbars and command buttons. Plot using layouts with multiple viewports in each layout. Smart dimensioning with linear, aligned, radial, diameter and angular dimensions. Draw hatch entities with more than 50 patterns included and also user patterns available from. Nearest, extension, perpendicular and intersection snaps. Object SNAP and TRACKING features enabled for precise and easy drafting. BabaCAD is first freeware CAD (no registration required) that support LISP programming and customization with API. Open existing CAD drawings from other CAD software saved in DXF or DWG format. Create your own CAD projects and save them in DXF 2000 format. ![]()
0 Comments
Leave a Reply. |