# Polyline Vertex Question

## Recommended Posts

Yeah it is, but the I wasn't getting the answer I was looking for, so I did some more digging and found this one and was hoping to get closer to the solution. I guess looking back I should have just referenced this post in the other one, sorry rookie mistake.

##### Share on other sites
Try in command line:

Click polyline to get DXF list:

Command: (setq plDxf(entget(car(entsel))))

Select object: ((-1 . <Entity name: 7efa3368>) (0 . "LWPOLYLINE") (330 .
<Entity name: 7efa1cf8>) (5 . "1AD") (100 . "AcDbEntity") (67 . 0) (410 .
"Model") (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 0) (43 . 0.0) (38 .
0.0) (39 . 0.0) (10 0.0 0.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 10.0 0.0) (40
. 0.0) (41 . 0.0) (42 . 0.0) (10 10.0 10.0) (40 . 0.0) (41 . 0.0) (42 . 0.0)
(10 0.0 10.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))

Remove all non 10 groups:

Command: (setq lst10(vl-remove-if '(lambda(x)(/= 10(car x)))plDxf))
((10 0.0 0.0) (10 10.0 0.0) (10 10.0 10.0) (10 0.0 10.0))

Remove first member of each list"

Command: (setq verLst(mapcar 'cdr lst10))
((0.0 0.0) (10.0 0.0) (10.0 10.0) (0.0 10.0))

Or at once:

Command: (mapcar 'cdr(vl-remove-if '(lambda(x)(/= 10(car x)))(entget(car(entsel)))))
((0.0 0.0) (10.0 0.0) (10.0 10.0) (0.0 10.0))

How would I change this last line of code to automattically select the last polyline drawn?

##### Share on other sites

(ssname (ssget "_X" (list (cons 0 "LWPOLYLINE"))) 0)

##### Share on other sites

You can get at the last entity entered into the drawing database using entlast.

##### Share on other sites
(ssname (ssget "_X" (list (cons 0 "LWPOLYLINE"))) 0)

Replace "entsel" with this?

##### Share on other sites
You can get at the last entity entered into the drawing database using entlast.

Do I replace "entsel" with "entlast", or use:

entsel(entlast)

?

##### Share on other sites

Replace

(car (entsel))

With

(entlast)

Or the code that CAB kindly provided.

Look up the entlast function in the Help files - you will see that it returns an ename (if successful), whereas entsel returns a list, therefore we can conclude that the 'car' must be replaced also, as we are not dealing with a list.

##### Share on other sites

Thanks a ton guys, really appriciate your help!!!

##### Share on other sites

Use this

(mapcar 'cdr(vl-remove-if '(lambda(x)(/= 10(car x)))(ssname (ssget "_X" (list (cons 0 "LWPOLYLINE"))) 0)))

Problem with (entlast) is that the last entity may not be a LWPolyline.

Unless you just created it.

The example I posted would bomb if there are no LWPolylines in the DWG.

##### Share on other sites

Want change this!

(defun C:LP(/ PNT1 P1X P1Y STDY DY COORDN COORDE PTXT)

(setq PNT1 (getpoint

"\nPick coordinate point: "))

(setq P1X (car pnt1)) ;x coord

(setq P1Y (cadr pnt1)) ;y coord

(setq STDX (rtos P1X 2 2))

(setq STDY (rtos P1Y 2 2))

(setq COORDN (strcat "N=" STDY ))

(setq COORDE (strcat "E= " STDX ))

(setq PTXT (getpoint

"\nPick text location: "))

(command "LEADER" PNT1 PTXT "" COORDN COORDE "")

(princ)

)

now print this

N=8566159.79

E= 505422.47

wanted this way

N=8.566.159,79

E= 505.422,47