Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with pickcsv autolisp

3 REPLIES 3
Reply
Message 1 of 4
sireath
348 Views, 3 Replies

Problem with pickcsv autolisp

Hi,

I have a problem with my autolisp. It was working fine until recently. The purpose of the autolisp is to select the point and it will automatically generate a csv file. However recently it is unable to generate the csv file. Can anyone help solve that part?

 

below is the codes.

 

(defun c:pickcsv()

(setq name (getstring "\nkey in file name:"))

(setq rad (getreal "\nkey in radius for circle (0 for no circle):"))

(setq th (getreal "\nkey in text height:"))

(setq rta (getstring "\nkey in rotation angle:"))

(setq mark (getstring "\nkey in mark layer: [mark]"))

(if (= mark "") (setq mark "mark"))

(setq num (getstring "\nkey in num layer: [num]"))

(if (= num "") (setq num "num"))

(setq f (open name "a"))

;;;(write-line "00NMSDR20 V02-03S123401-MAY-00 00:00 111111" f)

(setq i 1)

(initget "New")

(setq cor (getpoint "\nNew point number / <pick point>: "))

(while (/= cor nil)

(if (= cor "New")

(setq i (getint "\nkey in number:"))

(progn

(command "layer" "make" mark "")

(if (/= rad 0.0) (command "circle" cor rad))

(command "layer" "make" num "")

(setq ii (itoa i))

(setq cor1 (polar cor th th))

(command "_.text" cor1 th rta ii)

(setq x (rtos (car cor)))

(setq y (rtos (cadr cor)))

(setq z (rtos (caddr cor)))

;;;(setq li (strlen ii))

;;;(setq lx (strlen x) )

;;;(setq ly (strlen y) )

;;;(setq lli (- 4 li))

;;;(setq llx (- 10 lx))

;;;(setq lly (- 10 ly))

;;;(repeat lli (setq ii (strcat "0" ii)))

;;;(repeat llx (setq x (strcat x " ")))

;;;(repeat lly (setq y (strcat y " ")))

;;;(setq s (strcat "08KI" ii y x))

(setq s (strcat ii "," y "," x "," z ",PT"))

(setq s1 (strcat"current point " ii " N: " y " E: " x))

(write-line s1)

(write-line s f)

(setq i (+ i 1))

)

)

(initget "New")

(setq cor (getpoint "\nNew point number / <pick point>: "))

)

(close f)

)

3 REPLIES 3
Message 2 of 4
Ajilal.Vijayan
in reply to: sireath

Try by changing this line

(setq name (getstring "\nkey in file name:"))

 to something like this.

Then it will ask you to select a location for the file.

(setq name (getfiled "Select File" "" "csv" 1))

 

Message 3 of 4
sireath
in reply to: sireath

Thanks! Solved my problems and headache.

Message 4 of 4
Ajilal.Vijayan
in reply to: sireath

Welcome to Autodesk Forum !!

I am glad I was able to help.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost