Our design office uses vault for backup and history but the
rest of the engineering department has it’s own folder on a mapped network
drive. That’s where you’ll find contract specific files, as well as images,
schedules, emails and literally anything that the project needs.
So once
a drawing is approved we get to release it to the engineering shared folder and
need to place it in the project specific folders for dwf’s and pdf’s.
This is
a typical structure on the network of the engineering folder.
Root folder:
G:\Commercial & Engineering\Engineering\Contracts
where we have
105280-Pharmaceutical
105281-Industrial
105282-Scientific
105283-Healthcare
105285-Scotland
each split in hundreds for better
navigation by contract number:
001-099
100-199
200-299
then we
go project number and then drawing folder and pdf folder.
G:\Commercial &
Engineering\Engineering\Contracts\105281-Industrial\100-199\105281109 – Project
Description\Drawing\PDF
My task
was to create/modify existing ilogic to save current drawing as dwf and
pdf each in it’s folder on the G drive.
Here’s
the code I came up with:
' set the filepath of the contracts folder to start with. strStartFolder = "G:\Commercial & Engineering\Engineering\Contracts\" ' get the filename without extension
oFileName = ThisDoc.FileName(False)
' get the project type by reading the first
'6 digits of the filename EX 105280 or 105281
strFolderType = ( Left (oFileName,6))
' get the last 3 digits of the project no start
'after first 7 digits of filename Ex 005 or 109
strFolderNo = (Mid (oFileName,7, 3))
'get the first 9 digits to compose project type
'and number Ex 105281005 or 105281109
strFolderProj = ( Left (oFileName,9))
'get the document revision to use in the new filename
oRevNum = iProperties.Value("Project", "Revision Number") 'Set folder for project based on Contract No If strFolderNo < "100" Then strFolder3 = "\001-099\" ElseIf strFolderNo >= "100" Then strFolder3 = "\100-199\" ElseIf strFolderNo >= "200" Then strFolder3 = "\200-299\" End If 'Find folder in start path that contains Folder Type string Dim dir1() As String = System.IO.Directory.GetDirectories _
(strStartFolder, strFolderType & "*") 'Add Contract No folder to our folder Dim dir2 As String = String.Concat(dir1) & strFolder3 'Find folder in new path containing Folder Type Dim dir3() As String = System.IO.Directory.GetDirectories _
(dir2, strFolderProj & "*") 'Add Drawing folder to our path dir4 = String.Concat(dir3) & "\Drawing\" 'set name for the new files, adding revision to end strNameDWF = dir4 & oFileName & "_Rev" & oRevNum strNamePDF = dir4 & "PDF\" & oFileName & "_Rev" & oRevNum 'Do the save operation ThisDoc.Document.SaveAs(strNameDWF & (".dwf") , True) ThisDoc.Document.SaveAs(strNamePDF & (".pdf") , True) MessageBox.Show("All file formats saved in: " & dir4, "File Save")
Hope it makes sense; I did struggle with the code ( I am not a programmer) but Curtis Waguespack's website was inspiring.
ADS