Jump to content

Polyline Vertex Question


Lee Mac

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.

Link to comment
Share on other sites

  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    11

  • KRBeckman

    10

  • CAB

    4

  • ASMI

    2

Top Posters In This Topic

Posted Images

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?

Link to comment
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)

?

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

  • 7 years later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...