试试这个程序,让我知道它是怎么回事。。。。
- (defun c:Test (/ Deconstruct_String _att file st p pt)
- ;;; Tharwat 04. 01 2013 ;;;
- (defun Deconstruct_String (st delimiter / p l)
- (while (setq p (vl-string-search delimiter st 0))
- (setq l (cons (substr st 1 p) l)
- st (substr st (+ p 2) (strlen st))
- )
- )
- (if st
- (setq l (cons st l))
- )
- (setq l (reverse l))
- )
- (defun _att (pt string)
- (entmakex (list '(0 . "ATTDEF")
- (cons 10 pt)
- '(40 . 0.2)
- '(1 . "Pt")
- (cons 2 string)
- '(3 . "point")
- '(70 . 0)
- )
- )
- )
- (if (setq file (getfiled "Select Excel file ..." "" "csv" 16))
- (progn
- (setq file (open file "r"))
- (while (setq st (read-line file))
- (setq st (Deconstruct_String st ";"))
- (setq p (Deconstruct_String (car st) ","))
- (_att
- (setq
- pt (list (read (car p)) (read (cadr p)) (read (caddr p)))
- )
- (vl-list->string (vl-remove 32 (vl-string->list (last st))))
- )
- (entmakex (list '(0 . "POINT") (cons 10 pt)))
- )
- (close file)
- )
- (princ)
- )
- (princ)
- )
|