BIGAL Posted June 5, 2007 Share Posted June 5, 2007 We have the situation that running large jobs over our network becomes painfully slow. (please all those IT people we can not change the network 1500 users) To get around this we copy the job to our local drive the job creates a database of info as well as the DWG. What we want is a saveas option 1 copy drawing back to server (can do with new menu command) 2 copies a subdirectory to the network as well (part of new menu command) The first can be done through Autocad now but the second we must use explorer etc and rely on operator remembering to do. I had a look at using external commands through shelling to the OS and hinted at in the Acad.pgp file but can not get it to quite work using a copy command and a script. VBA may be better option any suggestions. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 7, 2007 Author Share Posted June 7, 2007 Further to my prior request tried editing the menu file changed ^c^c_saveas to ^c^c_saveas explorer ie run save autocad then pop up explorer window, saveas works but no explorer any ideas maybe just missing a slash or semicolon etc Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 7, 2007 Author Share Posted June 7, 2007 Another thought can someone provide the code to copy a file d:\myjobs\test to P:\jobno\design from within Autocad. Lisp or vba ok The file name will change but this can be read from the Autocad drawing open. Quote Link to comment Share on other sites More sharing options...
pefi Posted June 7, 2007 Share Posted June 7, 2007 http://www.exceltip.com/st/Basic_file_and_folder_examples_using_VBA_in_Microsoft_Excel/443.html FileCopy "d:\myjobs\test", "P:\jobno\design" Przemo Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 14, 2007 Author Share Posted June 14, 2007 Thank you thats exactly what I was looking for. The extra options are good check for existing etc It also showed me do the simple thing first, check the VBA help entering "file copy" locates that command. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 27, 2007 Author Share Posted July 27, 2007 Thank you for the information recieved but now I have another problem I need to use a wild card ie copy multifiles in one go using the *.* option does not work . Filecopy only seems to work with 1 file at a time I have now discovered that the software creates extra files depending on the type of job so you really dont know exactly how many to copy. Here is a bit of the code which does work but not with *.* civ3dfile = "*.*" SourceFile = newdatadrive + "\Civil 3D Projects\" + JOBNO + "\" + JOBNO + "-data\Advroads\" + civ3dfile DestinationFile = "P:\" + JOBNO + "\design\" + JOBNO + "-data\Advroads\" + civ3dfile FileCopy SourceFile, DestinationFile Any help would be appreciated Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 3, 2007 Author Share Posted August 3, 2007 Any one watching this found the answer You need a loop that looks at the directory and using Dir(filename) pulls each file name out and then copies it. Quote Link to comment Share on other sites More sharing options...
Megumby Posted October 3, 2008 Share Posted October 3, 2008 Are you able to post an example of your code? I've been trying the same thing. Thanks Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 7, 2008 Author Share Posted October 7, 2008 hope this helps you just need a form to enter the "jobno" and directory letter (newdatadrive) Private Sub commandbutton1_Click() Dim newdatadrive As String Dim jobno As String Dim MyPath, MyName, checkfile Dim SourceFile, DestinationFile As String Dim civ3dfile As String jobno = projectno.Value newdatadrive = datadrive.Value + ":" coggfilecopy1.Hide 'check to see if current drawing currentdwgname = ThisDrawing.GetVariable("Dwgname") 'noofchar = Len(currentdwgname) currentdwgname = Mid$(currentdwgname, 1, 7) 'only need 1st 7 characters 'MsgBox "dwg name" & currentdwgname If currentdwgname = jobno Then MsgBox "You can not save the drawing if you have it open" & (Chr(13)) & "Please close and try again" GoTo COGGEND End If checkfile = "P:\" + jobno + "\Design\" + jobno + "-data\" 'How to determine if a file exists in a folder: If Dir(checkfile, vbDirectory) = "" Then 'makenewdir MsgBox "Directory does not exist now making" MkDir "P:\" + jobno + "\Design\" + jobno + "-data" MkDir "P:\" + jobno + "\Design\" + jobno + "-data\Advroads\" Else MsgBox "Directory found now continue" & checkfile End If ' Define source file name D:\Civil 3D Projects\jobno\jobno.dwg. SourceFile = newdatadrive + "\Civil 3D Projects\" + jobno + "\" + jobno + ".dwg" ' Define target file name. DestinationFile = "P:\" + jobno + "\design\" + jobno + ".dwg" 'copy file MsgBox "file copied " & DestinationFile FileCopy SourceFile, DestinationFile ' Display the names in C:\ that represent directories. MyPath = newdatadrive + "\Civil 3D Projects\" + jobno + "\" + jobno + "-data\Advroads\" ' Set the path. 'myname = Dir(Mypath, vbDirectory) '1st entry MyName = Dir(MyPath) '2nd entry 1st is .. not needed Do While MyName <> "" ' Start the loop. SourceFile = newdatadrive + "\Civil 3D Projects\" + jobno + "\" + jobno + "-data\Advroads\" + MyName ' Define source file name D:\Civil 3D Projects\2006100\2006100.dwg. DestinationFile = "P:\" + jobno + "\design\" + jobno + "-data\Advroads\" + MyName ' Define source file name D:\Civil 3D Projects\2006100\2006100.dwg. FileCopy SourceFile, DestinationFile MsgBox "file copied " & MyName MyName = Dir ' Get next entry. Loop 'end of loop GoTo COGGEND notright: MsgBox "enter a job no or data drive" frmcoggfilecopy1.Show COGGEND: End Sub Quote Link to comment Share on other sites More sharing options...
Megumby Posted October 8, 2008 Share Posted October 8, 2008 Thanks for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.