Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatically save AutoCAD network files locally when opened.

4 REPLIES 4
Reply
Message 1 of 5
alien22
852 Views, 4 Replies

Automatically save AutoCAD network files locally when opened.

Is there a way to open an AutoCAD file over a network, automatically saves it on your hard drive, and when it is closed automatically saves it back to the network?

4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: alien22

If you open a file at location A and you save it using SaveAs and by giving it the same name at the location B, the file at the location A is left there unchanged, and you will end up with the same file at two different locations. So you could add the following code in your S::STARTUP routine (you will have to create it if you don't have one yet) and the job is done:

 

 

(vla-saveas
  (vla-get-activedocument (vlax-get-acad-object))
  (strcat
    "drive:\\the\\new\\destination\\path\\"
    (getvar 'dwgname)
  )
  acNative
)

 HTH

 

Message 3 of 5
Kent1Cooper
in reply to: alien22


@alien22 wrote:

Is there a way to open an AutoCAD file over a network, automatically saves it on your hard drive, and when it is closed automatically saves it back to the network?


I do something slightly different, but roughly equivalent [and probably better for one important reason -- see the end of this post].  Drawings continue to "live" on our Server as we work on them, but there are two buttons in a toolbar menu to back them up on the local computer.  One is named "Save (2) & Continue" and contains this:

 

^C^CQSAVE ;SAVE (strcat "C:/Local/Drive/Filepath/" (getvar "DWGNAME")) Y

 

That saves the drawing at its "home" location on the Server [twice, because I found that the second one often reduces the file size a little], and also saves its current state into a folder on the local computer, but leaves the User working in the Server file [look into the difference between Qsave and Save and SaveAs].

 

The other button is named "Zoom Limits/Save(2)/Close" and contains this:

 

^C^C-LAYER S 0  ZOOM (getvar 'limmin) (getvar 'limmax) QSAVE ;SAVE (strcat "C:/Local/Drive/Filepath/" (getvar "DWGNAME")) Y CLOSE

 

It does the same as the other, but first it sets the Layer to 0 and Zooms to the drawing limits, and after the saves it closes the drawing.

 

[In both cases, the first time it's used on a given drawing on a given computer, the question for which the "Y" answer is there (whether to replace it) is not asked, and an unknown-command messages goes past, but it doesn't interfere with anything.]

 

The main purpose of both is that if the Server goes down, you always have all the drawings you have been working on, in the latest state at which you used one of those buttons in them, on your computer, so you can open them from there and work on them while the Server problem is being dealt with.  Of course, once that happens, you then need to save them back to the Server location by other means than those buttons, because the location from which you're then working on them is your computer.

 

This approach also serves as a secondary backup for drawings that more than one person might work on.  If something gets corrupted on [or deleted from] the Server, and the daily tape backup copy is also bad or missing, it can be resurrected from the lastest viable state at which it was saved by whoever last worked on it and used one of those buttons.  Or if their copy is also bad, it may still be around in an earlier viable condition on someone else's computer.

 

Another little benefit is that the contents of that local filepath location serve as a record of all drawings worked on [in which those buttons were used] on a given computer, and show the last date & time they were saved that way.

 

Yet another is that I can foresee complications in what you describe with designating folder locations in saving back to the Network, unless you have an entire directory tree like the Network's on every individual computer.

 

Here's a reason why an approach like this is probably better than what you describe:  If you open a drawing from a Network and take it with something like SaveAs to your local computer for working on it, then the drawing file on the Network will no longer be open or locked.  That means that anyone else on the Network can open it just as you did, and won't have any way of knowing that you have it open.  Whoever is the last person to close it and save it back to the Network will "win" in terms of their work being contained in the file left on the Network, and all the work of anyone else who may have been working on that drawing will be lost!  If that's the approach, you would probably want to remove it from the Network while someone is working on it, if that doesn't seem to risky.

Kent Cooper, AIA
Message 4 of 5
dgorsman
in reply to: alien22

Very tricky to do by yourself.  Check out document management systems like Vault, if only to see what your system will need to consider.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 5 of 5
alien22
in reply to: dgorsman

dgorsman,

I have heard about Vault and a couple other data management systems that they can do what I am asking.  Unfortunately, IT is stating that we will have to get a special server specifically for them.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost