Added option to open file after export
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*._ls
|
||||
@@ -346,18 +346,41 @@
|
||||
(vl-load-com)
|
||||
(setq prefix (getvar "dwgprefix"))
|
||||
(setq basefilename (getvar "dwgname"))
|
||||
(setq filename(vl-string-right-trim ".dwg" basefilename))
|
||||
|
||||
; file path lengths
|
||||
(setq fn1 (strlen (getvar "dwgprefix")))
|
||||
(setq fn2 (strlen (getvar "dwgname")))
|
||||
(setq fullength (+ fn1 fn2 5 8))
|
||||
|
||||
(if (> fullength 255)
|
||||
(progn
|
||||
(setq prefix (strcat (getenv "USERPROFILE") "\\Desktop"))
|
||||
(setq filename(vl-string-right-trim ".dwg" basefilename))
|
||||
(setq savepath (strcat prefix "\\ACAD-" filename "_cleaned.dwg" ))
|
||||
(setq savepath (strcat prefix "ACAD-" filename "_cleaned.dwg" ))
|
||||
(command "._-AECEXPORTTOAUTOCAD" "f" "2013" "" savepath)
|
||||
(print "Too long filename, saved to desktop!")
|
||||
(savepath)
|
||||
)
|
||||
(progn
|
||||
(command "._-AECEXPORTTOAUTOCAD" "f" "2013" "s" "_cleaned" "" "")
|
||||
(strcat prefix "ACAD-" filename "_cleaned.dwg")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
; ------------------------------- openExported ------------------------------- ;
|
||||
|
||||
(defun openExported (path / openit )
|
||||
(initget 1 "Yes No")
|
||||
(setq openit (getkword "Open exported file? [Yes/No]"))
|
||||
(if
|
||||
(= openit "Yes")
|
||||
(progn
|
||||
(print (strcat "Opening document: " path))
|
||||
;; (command "fileopen" path)
|
||||
(vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) (strcat "\"" path "\"")))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -409,4 +432,5 @@
|
||||
(command "._REGENALL")
|
||||
|
||||
;; Export
|
||||
(checkedExportToAutocad)
|
||||
(setq exportpath (checkedExportToAutocad))
|
||||
(openExported exportpath)
|
||||
Reference in New Issue
Block a user