;;; HMsilva (Henrique) Routine to Copy all drawing (model) with basepoint 0.0.0 Paste in new dwg Save as and Overwrite existing file
;;; works with current open dwg
;;; Modified by Igal Averbuh 2016

(defun c:dcl (/ DirPath DwgFile Ofile Scrfile)
(setq DirPath (getvar 'DWGPREFIX)
Scrfile (strcat DirPath "test.scr")
Ofile (open Scrfile "w")
DwgFile (strcat DirPath (getvar 'DWGNAME))
)
(write-line "_.ucs\r\w\r" Ofile)
(write-line "-layer\ru\r*\r\r" Ofile)
(write-line "_.copybase\r0,0,0\rall\r\r" Ofile)
(write-line "_.close\rno\r" Ofile)
(write-line "_.new\r\r" Ofile)
(write-line "_.pasteclip\r0,0,0\r" Ofile)
(write-line "_.zoom\r_e\r" Ofile)
(write-line (strcat "_.saveas\r\r" (chr 34) DwgFile (chr 34) "\rYes\r") ofile)
;(write-line "_.close\r" Ofile)
(close Ofile)
(command "_.script" Scrfile)
;(vl-file-delete (strcat (getvar 'DWGPREFIX) "test.scr"))
(princ)
)
(c:dcl)

Advertisements