Jump to content

CAD Lisp code poly line vertex coords to txt file


vaidua

Recommended Posts

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

 

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

Link to comment
Share on other sites

  • 7 months later...

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

Edited by leo321
Link to comment
Share on other sites

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

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