自己用的特简单
可选文件夹,块被分解,不想分解就把“*”去掉,粘贴到原坐标,原坐标重叠的话把插入点改改也行。
我也是抄抄改改大佬的函数和代码
分享是个良性循环- (defun C:xwj ()
- (vl-load-com)
- (setq path (GXL-FILE-GETFOLDER))
- (setq file (VL-DIRECTORY-FILES path "*.dwg" 1))
- (foreach dwg file
- (command "insert" (strcat "*" path "\" dwg) '(0 0 0) 1 0)
- )
- )
- ;; (gxl-file-GetFolder "选择文件夹:") 返回值:字符串,文件夹路径,如果点了cancel, 返回nil
- (defun gxl-file-GetFolder (/ WinShell shFolder path catchit)
- (setq winshell (vlax-create-object "Shell.Application"))
- (setq shFolder (vlax-invoke-method
- WinShell 'BrowseForFolder 0 "选取文件夹" 1)
- )
- (setq
- catchit (vl-catch-all-apply
- '(lambda ()
- (setq shFolder (vlax-get-property shFolder 'self))
- (setq path (vlax-get-property shFolder 'path))
- )
- )
- )
- (if (vl-catch-all-error-p catchit)
- nil
- path
- )
- )
|