Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
539 Views, 3 Replies

Check In Saved Copy of Drawing

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