 - (defun c:tt (/ name a path)
- (setq name (cdr (assoc 1 (entget (car (entsel "\n选择图幅号:")))))
- name (strcat name ".dwg")
- )
- (if (setq a (findfile name))
- (command "insert" a '(0 0) "" "" "")
- (progn
- (setq path (getvar "users1"))
- (if (= path "")
- (progn
- (setq path (getFolder "选择图幅所在文件夹: "))
- (setvar "users1" path)
- )
- )
- (setq name (strcat path "\" name))
- (if (setq a (findfile name))
- (command "insert" a '(0 0) "" "" "")
- )
- )
- )
- (princ)
- )
- (defun getFolder (msg / WinShell shFolder path catchit path)
- (vl-load-com)
- (setq winshell (vlax-create-object "Shell.Application")
- shFolder (vlax-invoke-method WinShell 'BrowseForFolder 0 msg 1)
- catchit (vl-catch-all-apply
- '(lambda ()
- (setq shFolder (vlax-get-property shFolder 'self)
- path (vlax-get-property shFolder 'path)
- )
- )
- )
- )
- (if (vl-catch-all-error-p catchit)
- nil
- path
- )
- )
|