consider this:
LOGFILEON
LOGFILENAME
LOGFILEPATH
LOGFILEOFF
QAFLAGS 2 [for a long list]
command: list
See what hapens![]()

Registered forum members do not see this ad.
Hello Lisp forum!
Can you help i found this thread:
http://www.cadtutor.net/forum/showth...-Export-Points
I need a lisp routine thats could export polylines to a file called infile and it should look the same as the attached one. the file should be placed in the folder C:\user\ and if the routines can't find the folder it should create it.
Many many many thx in advance.
- Still a Novice Lisp programmer, but trying to learn....
consider this:
LOGFILEON
LOGFILENAME
LOGFILEPATH
LOGFILEOFF
QAFLAGS 2 [for a long list]
command: list
See what hapens![]()

Okay but i am not sure where to start changing the lisp routine ? I found this made by mfuccaro, thx mfuccaro. But i need it to make the file in C:\user\ and it should make the file similar to the one attached with the same filename. This about logname, logfilename ect. i am not sure how to use that? The problem is that we today use a VBA to do it but we change to 64 bit OS and AC and in the future VBA is not supported by AC. So thats why i need a lisp routine to be in a language that ac whould understand in the future. thx in advance.
Code:;export old style polyline vertex coords to a text file ; mfuccaro@hotmail.com (defun c:pl2txt ( / en ask i a file) (while (not ask) (setq en (car (entsel))) (if en (setq ask (= "LWPOLYLINE" (cdr (assoc 0 (entget en)))))) ) (setq file (open (getfiled "Output file" (strcat (getvar "dwgprefix") (substr (getvar "DWGNAME") 1 (- (strlen (getvar "dwgname")) 4))) "txt" ;file type 1) "w")) (setq i 0 sep ";") ;sep=separator (while (or (zerop i) a) (setq a (mapcar 'rtos (cdr (assoc 10 (entget (setq en (entnext en))))))) (if a (write-line (strcat (car a) sep (cadr a) sep (caddr a)) file)) (setq i (1+ i)) ) (close file) (princ (strcat "\n" (itoa (1- i)) " points exported")) (princ) )
- Still a Novice Lisp programmer, but trying to learn....

I found the code at afralisp and i want to retrive the z-coordinates but i can't make it do it correct can some body help , Please? Is it possible to make the file go in to the C:\user\ folder as it is now i always end up in the 'My document'. I the folder dosn't exist the will be okay report back to the user.
http://www.afralisp.net/visual-lisp/...nes-part-1.php
Many txh in advance.Code:(prompt "\nType \"vlplexport\" to run........") (defun c:vlplexport ( / theobj thelist n xval yval zval fname fn) ;load the visual lisp extensions (vl-load-com) ;get the entity and entity name (setq theobj (car (entsel "\nSelect a Polyline: "))) ;convert to vl object (setq theobj (vlax-ename->vla-object theobj)) ;check if it's a polyline (if (= (vlax-get-property theobj 'ObjectName) "AcDbPolyline") ;if it is, do the following (progn ;retrieve the coordinates (setq thelist (vlax-get-property theobj 'coordinates)) ;convert to a list (setq thelist (vlax-safearray->list (variant-value thelist))) ;zero the counter (setq n 0) ;create a text file (setq fname "infile") ;open it to write (setq fn (open fname "w")) ;write the header (write-line "PolyLine X, Y and Z Coordinates" fn) ;underline the header (write-line "*****************************************" fn) ;start the loop (repeat (/ (length thelist) 3) ;get the x coordinate (setq xval (rtos (nth n thelist))) ;increase the counter (setq n (1+ n)) ;get the y coordinate (setq yval (rtos (nth n thelist))) ;increase the counter (setq n (1+ n)) ;get the z coordinate (setq zval (rtos (nth n thelist))) ;write the x coordinate to the file (write-line (strcat "X-Value : " xval) fn) ;write the y coordinate to the file (write-line (strcat "Y-Value : " yval) fn) ;write the z coordinate to the file (write-line (strcat "z-Value : " zval) fn) ;add a seperator (write-line "-----------------------------" fn) ;increase the counter (setq n (1+ n)) );repeat ;close the file (close fn) );progn ;it's not a polyline, inform the user (alert "This is not a Polyline! - Please try again.") );if (princ) );defun ;------------------------ ;clean loading (princ) ;--------------------------- ;End of VL-POLY.LSP ;---------------------------
- Still a Novice Lisp programmer, but trying to learn....
See these functions in the Help file:
Code:;check if folder exist (if (not (vl-file-directory-p "c:/User")) (progn (alert "Does not exist. Create one...") (vl-mkdir "c:/User") ;check again, who knows? (if (vl-file-directory-p "c:/User") (progn (alert "Now it was created. Go to write your data") ;;write data here (progn (alert "Exist. You can write your data") ;;write data here ) ) ) ) )
~'J'~
The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

You're welcome
Cheers
~'J'~
The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

Registered forum members do not see this ad.
But i am still strugling to get the Z-coordinates correct txh in advance
- Still a Novice Lisp programmer, but trying to learn....
Bookmarks