cad123
Structural
- Aug 15, 2002
- 49
I have one file .xls have coordinate of point
ex H502 73847.83 82333.93 (H502 is name of point )
-------------------------
-------------------------
how can I import it to Cad
I wrote a lisp for this work, but it have problem at name of point ( it must is number, I can not solve char and number, ex 502 is OK, but H502 it message symbol error)and sometime have problem with Y-coordinate ( some time not correct miss some numbers)
Could you advice me?
I send it here :
(please make a text style with height >0, and make a block name is bor first)
-------------
(defun C:dab (/ FN PR RL PT PT1 Len Len1 i j A B X Y Lst Le fi na lena)
(setq FN(getfiled "Select a data file " "" "txt" 0 ))
( if (null FN)
(princ " No file selected!"
(progn
(setq PR (open FN "r")
(setq lst nil)
(setq lst2 nil)
(while (setq RL(read-line PR))
;(princ RL)
(setq i 0)
(setq j 0)
(setq na (itoa(read RL))) ;Input first element (name of point)
;(princ (type na))
;(princ na)
(setq Lena (strlen na)) ; length of RL
(setq j (+ Lena 1))
;-------
(setq RL (substr RL j))
;-------
(setq Len (strlen RL)) ; length of RL
;(princ len)
(setq A (rtos(read RL))) ;Input first element convert to str
;(princ A)
(setq Len1 (strlen A)) ; length A
(setq i (+ Len1 1)) ; i = length A +1
(setq B (substr RL i)) ; B return sub string on RL
;(princ B)
(setq X (atof A)
Y (atof B)
)
(setq PT (list X Y))
;(princ PT)
(setq Lst (append Lst (list PT)))
;(setq na (atoi na))
(setq Lst2 (append lst2 (list na)))
); close while 1
;(princ lst2)
(close PR)
(setq fi (car lst))
(setq lst (cdr lst))
;(princ lst)
(command ".insert" "bor" fi "" "" "" )
(setq fi1 (car lst2))
;(princ(type fi1))
(setq lst2 (cdr lst2))
(command ".text" fi "" fi1 "" ""
(foreach Le Lst
(command ".insert" "bor" le "" "" "" )
(setq fi2 (car lst2))
(setq lst2 (cdr lst2))
(command ".text" le "" fi2 "" "" )
)
;(command ""
); close progn
);close if
(princ)
)
ex H502 73847.83 82333.93 (H502 is name of point )
-------------------------
-------------------------
how can I import it to Cad
I wrote a lisp for this work, but it have problem at name of point ( it must is number, I can not solve char and number, ex 502 is OK, but H502 it message symbol error)and sometime have problem with Y-coordinate ( some time not correct miss some numbers)
Could you advice me?
I send it here :
(please make a text style with height >0, and make a block name is bor first)
-------------
(defun C:dab (/ FN PR RL PT PT1 Len Len1 i j A B X Y Lst Le fi na lena)
(setq FN(getfiled "Select a data file " "" "txt" 0 ))
( if (null FN)
(princ " No file selected!"
(progn
(setq PR (open FN "r")
(setq lst nil)
(setq lst2 nil)
(while (setq RL(read-line PR))
;(princ RL)
(setq i 0)
(setq j 0)
(setq na (itoa(read RL))) ;Input first element (name of point)
;(princ (type na))
;(princ na)
(setq Lena (strlen na)) ; length of RL
(setq j (+ Lena 1))
;-------
(setq RL (substr RL j))
;-------
(setq Len (strlen RL)) ; length of RL
;(princ len)
(setq A (rtos(read RL))) ;Input first element convert to str
;(princ A)
(setq Len1 (strlen A)) ; length A
(setq i (+ Len1 1)) ; i = length A +1
(setq B (substr RL i)) ; B return sub string on RL
;(princ B)
(setq X (atof A)
Y (atof B)
)
(setq PT (list X Y))
;(princ PT)
(setq Lst (append Lst (list PT)))
;(setq na (atoi na))
(setq Lst2 (append lst2 (list na)))
); close while 1
;(princ lst2)
(close PR)
(setq fi (car lst))
(setq lst (cdr lst))
;(princ lst)
(command ".insert" "bor" fi "" "" "" )
(setq fi1 (car lst2))
;(princ(type fi1))
(setq lst2 (cdr lst2))
(command ".text" fi "" fi1 "" ""
(foreach Le Lst
(command ".insert" "bor" le "" "" "" )
(setq fi2 (car lst2))
(setq lst2 (cdr lst2))
(command ".text" le "" fi2 "" "" )
)
;(command ""
); close progn
);close if
(princ)
)