Author Topic: Moving and copying a file  (Read 6034 times)

0 Members and 1 Guest are viewing this topic.

hudster

  • Gator
  • Posts: 2848
Re: Moving and copying a file
« Reply #15 on: September 28, 2005, 07:58:51 AM »
I came up with this one for when a modified drawing is issued.

Code: [Select]
;;;
;;; TITLE:issdwg.lsp
;;;
;;; Copyright (C) 2005 by Andy Hudson
;;;
;;; Permission to use, copy, modify, and distribute this
;;; software and its documentation for any purpose and without
;;; fee is hereby granted
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR
;;; IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY
;;; PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY
;;; DISCLAIMED.
;;;
;;; Andy Hudson
;;; April 2005
;;;
;;;-------------------------------------------------------------
;;; Description:
;;;
;;; Routine to make Issuing a drawing comply with company Standards
;;; The routine Moves the file to the current folder to ensure only
;;; current drawings remain in the current folder, with a copy
;;; made and bound in the issued folder.
;;;
;;;-------------------------------------------------------------
;;; COMMAND
;;; issdwg
;;;-------------------------------------------------------------
;;;
;;error checker from www.afralisp.com
;;;
(LOAD "x:/aids/blocks/rybka_blocks/lisps/ERROR.LSP")
;;
(DEFUN C:issdwg (/ dirname newdirname filename origfile oldfiledia newfile issname issdir issfile)
  ;;GET DIRECTORY INFORMATION
  (SETQ dirname (GETVAR "DWGPREFIX")
newdirname (VL-STRING-TRIM "\\Mods" dirname)
filename (getvar "dwgname")
origfile (strcat dirname filename))
  ;;save the drawing
  (setq oldfiledia (getvar "filedia"))
  (setvar "filedia" 0)
  (setq newfile (strcat newdirname "\\" filename))
(if (findfile newfile)
(alert (strcat "File " newfile  " already exists In Folder! "))
(progn
(princ (strcat "\nSaving: " Newfile "\n" ))
  (command "._saveas" "" newfile)
);progn
);if
  (setvar "filedia" oldfiledia)
  ;;Save to issued folder
  ;;Create Directory & File Information
  (setq issname (vl-string-trim "current" newdirname))
  ;;create Issued folder
  (setq issdir (strcat issname "Issued"))
  (vl-mkdir issdir)
  ;;create issue file
  (Setq issdir (vl-string-subst "Issued" "current\\Mods" dirname))
  (setq issfile (strcat issdir filename))
  ;;save the file
  (command "._saveas" "" issfile)
  (command "-xref" "bind" "*")
  (command "-purge" "all" "*" "n")
  (command "-purge" "all" "*" "n")
  (command "-purge" "all" "*" "n")
  (command "-purge" "all" "*" "n")
  (command "-purge" "all" "*" "n")
  (command "qsave")
  ;;delete the old file
  (vl-file-delete origfile)
  (princ)
  )
  (PROMPT "\n Issue Drawing Lisp loaded, enter issdwg to run.")
  (princ)
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue