Thank you, it works perfectly.
"Rodney McManamy" wrote in message
news:82EEED6578AE334073E886A60CE531DC@in.WebX.maYIadrTaRb...
> I don't think that R14 supported the dwgprops so I'm guessing that you
would
> be appending the revised drawing name.
> Drawing-A.dwg -> Drawing-B.dwg
>
> This is quick and dirty, no error checking involved bu will look for a
> drawing revision at the end of the filename -A. If no revision is found
> then it will create the -A revision. It will also attempt to create an
> Old_Drawings subdirectory and move the old file over. It also saveas the
> new drawing as the R14 dwg type for you. Help it helps but I haven't had
my
> morning coffee yet so I don't give any warranties. But it worked on my
> NT4.0 and AutoCAD 2000i.
>
> (defun c:revision (/ mac_acadapp mac_acaddoc
> mac_acaddoc_name mac_acaddoc_basename mac_acaddoc_path
> mac_acaddoc_fullname mac_oldrevision mac_acaddoc_basename
> mac_newrevision mac_acaddoc_newname mac_acaddoc_newpath
> mac_acaddoc_newfullname
> )
> (vl-load-com)
> (setq mac_acadapp (vlax-get-acad-object)
> mac_acaddoc (vlax-get-property mac_acadapp 'activedocument)
> mac_acaddoc_name (vlax-get-property mac_acaddoc 'name)
> mac_acaddoc_basename (vl-filename-base mac_acaddoc_name)
> mac_acaddoc_path (vlax-get-property mac_acaddoc 'path)
> mac_acaddoc_fullname (vlax-get-property mac_acaddoc 'fullname)
> )
> ;; Determine if a drawing revision already exists as a letter
> (if (wcmatch mac_acaddoc_basename "*-@")
> (setq mac_oldrevision (strcase (substr mac_acaddoc_basename
(strlen
> mac_acaddoc_basename)))
> mac_acaddoc_basename (substr mac_acaddoc_basename 1 (- (strlen
> mac_acaddoc_basename) 2))
> mac_newrevision (chr (+ (ascii mac_oldrevision) 1))
> )
> (setq mac_newrevision "A")
> )
> (setq mac_acaddoc_newname (strcat mac_acaddoc_path "\\"
> mac_acaddoc_basename
> "-" mac_newrevision ".dwg"
> )
> )
> (vlax-invoke-method mac_acaddoc 'saveas mac_acaddoc_newname acr14_dwg)
> ;; Verify that the drawing was actually saved
> (if (= (strcase (vl-filename-base mac_acaddoc_newname))
> (strcase (vl-filename-base (vlax-get-property mac_acaddoc 'name)))
> )
> (progn
> (alert (strcat "Drawing was saved as a new revision:\n"
> mac_acaddoc_newname))
> ;; Move the old drawing to an Old_Drawings Directory
> (setq mac_acaddoc_newpath (strcat mac_acaddoc_path
> "\\Old_Drawings")
> mac_acaddoc_newfullname (strcat mac_acaddoc_newpath "\\"
> mac_acaddoc_name)
> )
> ;; Verify that the directory exists or create it
> (if (= (vl-directory-files mac_acaddoc_newpath nil) nil)
> (vl-mkdir mac_acaddoc_newpath)
> )
> (if (vl-directory-files mac_acaddoc_newpath nil)
> ;; Check if a drawing already exists in the Old_Drawings Directory
> (if (findfile mac_acaddoc_newfullname)
> (alert
> (strcat "An existing file with the same name was\nfound in the
> following directory:\n"
> mac_acaddoc_newpath
> "\nThe old drawing cannot be moved over to this directory."
> )
> )
> ;; No existing drawing was found so try to copy the old drawing over
> (if (vl-file-copy mac_acaddoc_fullname mac_acaddoc_newfullname)
> (if (vl-file-delete mac_acaddoc_fullname)
> (alert
> (strcat "The old drawing was moved over to this directory:\n"
> mac_acaddoc_newpath)
> )
> (alert (strcat "The old drawing was copied over to this
directory:\n"
> mac_acaddoc_newpath
> "\nBut it could not be deleted from the original directory."
> )
> )
> )
> (alert (strcat "The old drawing could not be copied to the following
> directory:\n"
> mac_acaddoc_newpath
> )
> )
> )
> )
> (alert (strcat "The following directory could not be created:"
> mac_acaddoc_newpath
> "\nThe old drawing cannot be moved over to this directory."
> )
> )
> )
> )
> (alert "An error occurred and the drawing was\nnot saved as a new
> revision")
> )
> (princ)
> )
>
> --
> Rodney McManamy
> President
> MACSolids
> Maximizing AutoCAD Solids
> rmcmanamy@macsolids.com
> "John Laidler" wrote in message
> news:DB752E1A197C4A46CA3FC6695ED7129A@in.WebX.maYIadrTaRb...
> > We're using A2Ki, but saving as R14.
> > The command shouldn't perform each time the drawing is opened, rather it
> > should perform when prompted.
> >
> > "Rodney McManamy" wrote in message
> > news:53D0DAC15352A720CA1A71A725EE7B14@in.WebX.maYIadrTaRb...
> > > It sounds simple enough. If your using R2000 or R2000i I may be able
to
> > > help you out. Do you want a command to perform this each time they
open
> a
> > > drawing or just when they run the command. Also, are all of the
> drawings
> > > R2000 with the dwgprops tracking the revisions?
> > >
> > > --
> > > Rodney McManamy
> > > President
> > > MACSolids
> > > Maximizing AutoCAD Solids
> > > rmcmanamy@macsolids.com
> > > "John Laidler" wrote in message
> > > news:4EFB32A9DC86A5DC4CB7DDA9CD170C9E@in.WebX.maYIadrTaRb...
> > > > We are currently looking for a program or software that will
> > automatically
> > > > update a drawing's revision. Then move the older drawing to an
> archive
> > > > directory, or change the revision letter in the drawing name. Any
> > > > suggestions would be greatly appreciated.
> > > >
> > > > --
> > > > John Laidler
> > > > Cad Manager
> > > > Duckworth & Associates, Inc.
> > > > (734) 455-7500
> > > >
> > >
> >
>