+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3
Results 21 to 30 of 30
  1. #21
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Dec 2009
    Posts
    200

    Default

    Registered forum members do not see this ad.

    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.

  2. #22
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Dec 2009
    Posts
    200

    Default

    Quote Originally Posted by ASMI View Post
    Try in command line:

    Click polyline to get DXF list:

    Code:
    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:

    Code:
    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"

    Code:
    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:

    Code:
    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?

  3. #23
    Super Member CAB's Avatar
    Using
    AutoCAD 2000
    Join Date
    May 2004
    Location
    Tampa, Florida
    Posts
    804

    Default

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

  4. #24
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,347

    Default

    You can get at the last entity entered into the drawing database using entlast.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  5. #25
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Dec 2009
    Posts
    200

    Default

    Quote Originally Posted by CAB View Post
    (ssname (ssget "_X" (list (cons 0 "LWPOLYLINE"))) 0)
    Replace "entsel" with this?

  6. #26
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Dec 2009
    Posts
    200

    Default

    Quote Originally Posted by Lee Mac View Post
    You can get at the last entity entered into the drawing database using entlast.

    Do I replace "entsel" with "entlast", or use:
    Code:
    entsel(entlast)
    ?

  7. #27
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,347

    Default

    Replace

    Code:
    (car (entsel))
    With

    Code:
    (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.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  8. #28
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Dec 2009
    Posts
    200

    Default

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

  9. #29
    Super Member CAB's Avatar
    Using
    AutoCAD 2000
    Join Date
    May 2004
    Location
    Tampa, Florida
    Posts
    804

    Default

    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.

  10. #30
    Junior Member leo321's Avatar
    Computer Details
    leo321's Computer Details
    Operating System:
    w7 64bt
    Computer:
    TOSHIBA / DELL
    CPU:
    i5 3°generation
    RAM:
    4 gb other 6gb
    Graphics:
    1gb other 2gb
    Primary Storage:
    500gb
    Secondary Storage:
    2 tera
    Monitor:
    21' and 17'
    Discipline
    Structural
    leo321's Discipline Details
    Occupation
    design Project
    Discipline
    Structural
    Details
    Pipelines, Industrials Units, Wind Farms, Minig, transmission line, thermoelectric, etc..
    Using
    AutoCAD 2012
    Join Date
    Jan 2013
    Location
    São Paulo / Brazil
    Posts
    21

    Default

    Registered forum members do not see this ad.

    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

Similar Threads

  1. Increase vertex of 3dmesh
    By MR MAN in forum AutoCAD 3D Modelling & Rendering
    Replies: 6
    Last Post: 11th Sep 2008, 03:20 pm
  2. add vertex z or elevation to points
    By gvlisnas in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 4th Aug 2007, 11:14 pm
  3. reading from vertex files
    By gib65 in forum AutoCAD 3D Modelling & Rendering
    Replies: 5
    Last Post: 1st Feb 2007, 06:35 am
  4. Viewing 3DSolid vertex
    By LeoRoncetti in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 2nd May 2006, 01:14 am
  5. newb! question - join polyline then fillet
    By pdlefief in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 10th Apr 2006, 09:32 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts