当然
试一试,让我知道。
- (defun c:test (/ _parse do sp bk bn f on st l)
- ;; Tharwat 13.08.2015 ;;
- (setq do (vla-get-activedocument (vlax-get-acad-object))
- sp (vla-get-block (vla-get-activelayout do))
- )
- (cond
- ((not (and (setq
- bn
- (getstring t
- "\nSpecify name of the Attributed Block Name :"
- )
- )
- (/= bn "")
- (tblsearch "BLOCK" bn)
- )
- )
- (princ (strcat "\nEmpty value or Block name < "
- bn
- " > is not existed in current drawing !"
- )
- )
- )
- ((setq f (getfiled "Select Excel file :"
- (getvar 'dwgprefix)
- "csv"
- 16
- )
- )
- (setq on (open f "r"))
- (defun _parse (s / pos lst)
- (while (setq pos (vl-string-search ";" s 0))
- (progn (setq lst (cons (substr s 1 pos) lst))
- (setq s (substr s (+ pos 2) (strlen s)))
- )
- )
- (if (and s (/= s ""))
- (setq lst (cons s lst))
- )
- (setq lst (reverse lst))
- )
- (while (setq st (read-line on))
- (if (and (setq l (_parse st))
- (= (length l) 3)
- (setq bk (vla-insertblock
- sp
- (vlax-3d-point (read (cadr l)) (read (caddr l)))
- bn
- 1.0
- 1.0
- 1.0
- 0.
- )
- )
- )
- (vla-put-textstring
- (car (vlax-invoke bk 'getattributes))
- (car l)
- )
- )
- )
- (close on)
- )
- )
- (princ)
- )(vl-load-com)
|