马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
 - (defun _BrowseForFolder (msg path / *error* acApp oShell oFolder)
- ;; Examples:
- ;; (_BrowseForFolder "Select a Folder" nil)
- ;; (_BrowseForFolder nil nil)
- ;; (_BrowseForFolder nil "C:\\users")
- (defun *error* (msg)
- (if oShell
- (vlax-release-object oShell)
- )
- (cond ((not msg)) ; Normal exit
- ((member msg '("Function cancelled" "quit / exit abort")))
- ; <esc> or (quit)
- ((princ (strcat "\n** Error: " msg " ** ")))
- ; Fatal error, display it
- )
- (if oFolder
- path
- nil
- )
- )
- (and (or (and (= 'STR (type path)) (findfile path))
- (setq path (+ 1 64 256))
- )
- (or (= 'STR (type msg))
- (setq msg "Select a Folder to Search")
- )
- (setq acApp (vlax-get-acad-object))
- (setq oShell (vla-getinterfaceobject acApp "Shell.Application"))
- (setq oFolder (vlax-invoke
- oShell
- 'BrowseForFolder
- (vla-get-hwnd acApp)
- msg
- 0
- path
- )
- )
- (setq
- path (vlax-get-property (vlax-get-property oFolder 'Self) 'Path)
- )
- )
- (*error* nil)
- )
|