+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2015
    Join Date
    Apr 2017
    Posts
    2

    Default CAD Lisp code poly line vertex coords to txt file

    Registered forum members do not see this ad.

    Hello,

    I'm using Lee Mac cad lisp program "PolyInfo V 1.3." for exporting polylines vertex coordinates. But for full work joy I need some modifications.

    URL for program: http://www.lee-mac.com/polyinfo.html
    URL for code: http://www.lee-mac.com/lisp/html/PolyInfoV1-3.html

    As you saw the program exports a lot of information about the polyline. So i want to modify the code that will export just polyline start vertex points x and y coords in two columns ( my cad version information exports to txt file ).

    The result should look like this:
    ________________________________
    Polyline starts points x
    649542.45
    649542.35
    649542.28

    Polyline starts points y

    495232.54
    495232.23
    495232.41
    ________________________________

    Can someone help to figure out which part of code I must to modify to get the result i want? Please.

  2. #2
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,126

    Default

    Have you tried his Point Manager ?

  3. #3
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2015
    Join Date
    Apr 2017
    Posts
    2

    Default

    Unfortunately I did, but I'm using not exact AutoCAD program. I'm using ZW CAD. I's cheaper version of cad program. So the comand line promt " ** Dialog File could not be Written ** ". Yach sometimes not all lisp programs works.

    I just found an easier code of exporting X Y coordinates.

    URL : http://www.eng-tips.com/viewthread.cfm?qid=195727

    It is almost what i need. The result of code : (x coordinate) , (Y coordinate)
    (x coordinate) , (Y coordinate)

    But, can I change the code that coords print not in line, but in separated columns? for example:
    (x coordinate)
    (x coordinate)

    (Y coordinate)
    (Y coordinate)

  4. #4
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,821

    Default

    You can go back to 1st step basics and use the 'getcoordinates function then export what you want in the way you want. have a look at this example.

    Code:
    ; pline co-ords example
    ; By Alan H
    (defun getcoords (ent)
      (vlax-safearray->list
        (vlax-variant-value
          (vlax-get-property
        (vlax-ename->vla-object ent)
        "Coordinates"
          )
        )
      )
    )
     
    (defun co-ords2xy ()
    ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
    (setq len (length co-ords))
    (setq numb (/ len 2)) ; even and odd check required
    (setq I 0)
    (repeat numb
    (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
    ; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))
    (setq co-ordsxy (cons xy co-ordsxy))
    (setq I (+ I 2))
    )
    )
    ; program starts here
    (setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
    (co-ords2xy) ; list of 2d points making pline
    (princ co-ordsxy)
    A man who never made mistakes never made anything

  5. #5
    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

    want change this

    Labeling N,E Coordinates with Leader - David B. Stewart

    (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)
    )


    come this way

    N=8566159.79
    E= 505422.47


    wanted this way

    N=8.566.159,79
    E= 505.422,47


    Want to know if it is possible that default
    Last edited by leo321; 9th Nov 2017 at 07:19 pm.

  6. #6
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    565

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by leo321 View Post
    wanted this way

    N=8.566.159,79
    E= 505.422,47
    never seen such number format, comma as decimal point?

    not this?
    N=8,566,159.79
    E= 505,422.47

    google "format number with thousand separator" many examples with others language as well
    lambda not optimized.. ( apply '= "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" ) ; error: too many arguments

Similar Threads

  1. Lisp needed for Poly line with dimensions refference with building
    By YSRINY2I in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 18th May 2016, 11:48 am
  2. lisp needed : extract poly line vertex X,Y into txt file
    By ayman_48 in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 11th May 2016, 05:09 pm
  3. Lisp to import coords and code from txt/xls file...
    By goldy2000 in forum AutoLISP, Visual LISP & DCL
    Replies: 75
    Last Post: 4th May 2016, 10:44 am
  4. Replies: 1
    Last Post: 18th Jun 2015, 04:01 am
  5. Select polyline vertex coords by number
    By Johntosh in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 6th Jan 2009, 01:33 pm

Tags for this Thread

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