Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JelteDeJong
in reply to: Anonymous

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.

EESignature


Blog: hjalte.nl - github.com