- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Guys,
I'm trying to find out how to check in a file that I have already saved a different copy of with a different name than the original. Fo example, original model may be called '0123456.ipt' but once my rule runs, the machine drawing becomes '0123456 - 50mm.ipt' etc. I would like to be able to check in this machine drawing version as I am saving it if possible. I've already tried to find the information on here and the greater Internet and found the info here very useful (https://forums.autodesk.com/t5/inventor-forum/ilogic-check-in-drawing-into-vault/td-p/4735987) but it checks in my original file and I'm not good enough in Inventor to wriggle my way around this one.
Any help is much appreciated.
Dim modelname As String
Dim odoc As Document
'saved = False
iLogicForm.Show("Save Drawing")
modelname = iProperties.Value("Summary", "Title")
If saved = True Then
ThisDoc.Document.saveasinventordwg("[MACHINE DRAWING FILEPATH]" & modelname & ".dwg", True)
'oPath = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension
oRevNum = iProperties.Value("Project", "Revision Number")
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
'oFolder = "[FILEPATH]"
'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4
'End If
'get PDF target folder path
oFolder = "[PDF DRAWING FILEPATH]"
'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If
'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & modelname & ".pdf"
'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2(False)
Else
Logger.Debug("saved?: " & saved)
Exit Sub
End If
saved = False
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For additional reference, my drawing template is the one that is being altered (called 'drawing_template'). It changes names during the saving process to the name of the model and the the distinguisher (i.e. '0123456 - 50mm') but when I check it in to Vault via iLogic, it is drawing_template that is being checked in and not 0123456 - 50mm. I'm not sure on how to make sure the new file is the one being affected.
Thank you again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, i have no vault at home there for this is my best guess without being able to check it for you. The checkin command that you are using will always checkin the active file. afther you save the new file it is not opend therfore it will be checked in. the solotion is then to open the file before using the checkin command. like this. (i added the red line).
Dim modelname As String
Dim odoc As Document
'saved = False
iLogicForm.Show("Save Drawing")
modelname = iProperties.Value("Summary", "Title")
If saved = True Then
ThisDoc.Document.saveasinventordwg("[MACHINE DRAWING FILEPATH]" & modelname & ".dwg", True)
'oPath = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension
oRevNum = iProperties.Value("Project", "Revision Number")
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
'oFolder = "[FILEPATH]"
'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4
'End If
'get PDF target folder path
oFolder = "[PDF DRAWING FILEPATH]"
'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If
'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & modelname & ".pdf"
'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
ThisApplication.Documents.Open("[MACHINE DRAWING FILEPATH]" & modelname & ".dwg")
ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2(False)
Else
Logger.Debug("saved?: " & saved)
Exit Sub
End If
saved = False
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is great @JelteDeJong ! Looks like this has totally resolved it. Thanks for your help!