Autodesk Vault Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Creating PDF's from a drawing within the Vault Client
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Vault Professional 2012.
Do we have access to the batch plot or any printing/plotting functions built into the Vault Client through the API?
Most of our vendors and clients require PDFs. To that end what we do is manually create a PDF from inventor whenever updating and checking in a drawing.
I have developed a Vault Add-In that allows a user to grab the BOM from an item card, or Associated files from an Inventor Assembly. The "BOM" is then displayed in a multi-level grid with all the information pertinent to us. Title, Description, Revision etc.
I can then click on a button and have all of the related DWFs placed into a folder of choice, have them automatically named/renamed according to our standards with little or no input required by the user.
What I would like is to do the same using PDF instead of DWF, thus eliminating the (often missed) manual process of creating the PDF as we update drawings.
Re: Creating PDF's from a drawing within the Vault Client
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Vault uses DWF as the default format for viewing the drawing, and changing this is not recommended because you may encounter some problems that are not expected and nobody tested those. You can consider to auto-generate the PDF through Inventor API.
EventWatcher is a tool from Inventor SDK. You can use it to view what command is called when updating properties or checking file from Inventor. Two events are useful regrading to this:
1) UserInputEvents.OnActivateCommand
2) UserInputEvents.OnTerminateCommand
And the command names that I found are:
VaultCheckinTop,
VaultPropertyWriteBack
You can use an Inventor AddIn application to capture those events, similar like EventWatcher, and do your business logic when those commands in your interest are called.
Inventor PDF translator can create the PDF file for you. There are existing sample in Inventor API document.
Hope this helps.
Developer Technical Services
Autodesk Developer Network
Re: Creating PDF's from a drawing within the Vault Client
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Here is some code that does the trick?
But read my remarks in the OnTerminate command. and how do we now grab the pdf and upload it to vault?
regards kent boettger
Private Sub m_UserinputEvents_OnActivateCommand(ByVal CommandName As String, ByVal Context As Inventor.NameValueMap) Handles m_UserinputEvents.OnActivateCommand
If (CommandName = "VaultCheckinTop") Then
MsgBox("You are about to checkin a drawing to vault")
PublishSinglePDF()
End If
End Sub
Private Sub m_UserinputEvents_OnTerminateCommand(ByVal CommandName As String, ByVal Context As Inventor.NameValueMap) Handles m_UserinputEvents.OnTerminateCommand
If CommandName = "VaultCheckinTop" Then
'the question here is how do we actually check that the user checked in the drawing? and did no cancel the checkin
'here i figure we have to make a call into vault and somehow check that the version number increased.
'or is this version number somehow stored in the drawing file. because at this point the pdf is allready created
'and we have to go and delete it again if the user canceled the checkin. or can we maybe compare something inside the file before and after the checkin?
End If
End Sub
Public Sub PublishSinglePDF()
On Error Resume Next
m_inventorApplication = GetObject(, "Inventor.Application")
m_Document = m_inventorApplication.ActiveDocument
If m_Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("No pdf was Created")
Exit Sub
End If
If m_Document.FileSaveCounter < 1 Then
MsgBox("You must save the file, before you can create the pdf")
Exit Sub
Else
' Get the PDF translator Add-In.
Dim PDFAddIn As TranslatorAddIn
PDFAddIn = m_inventorApplication.ApplicationAddIns.ItemById(" {0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
Dim oContext As TranslationContext
oContext = m_inventorApplication.TransientObjects.CreateTrans lationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism 'kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
oOptions = m_inventorApplication.TransientObjects.CreateNameV alueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
oDataMedium = m_inventorApplication.TransientObjects.CreateDataM edium
' Check whether the translator has 'SaveCopyAs' options
If PDFAddIn.HasSaveCopyAsOptions(m_Document, oContext, oOptions) Then
' Options for drawings...
oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 1
Dim Pdf_File_Name As String
Pdf_File_Name = m_Document.FullFileName.Substring(0, m_Document.FullFileName.Length - 4)
oDataMedium.FileName = (Pdf_File_Name & ".pdf")
'Publish document.
Call PDFAddIn.SaveCopyAs(m_Document, oContext, oOptions, oDataMedium)
End If
End If
If m_Document.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("You checked in a file to vault, the pfd was created in the local folder where the checked in drawing is")
End If
End Sub
Re: Creating PDF's from a drawing within the Vault Client
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Creating PDF's from a drawing within the Vault Client
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This was supplied to me by Steve Bedder but will probably help you (It was written to work with Inventor iLogic):
Public Sub InsertObjectSample()
Dim doc As Document
Set doc = ThisApplication.ActiveDocument
' Verify the active document has been saved.
If doc.FullFileName = "" Then
MsgBox "This document must be saved first."
Exit Sub
End If
' Build the filename based on the filename of the active document.
Dim filename As String
filename = doc.FullFileName
filename = Left$(filename, InStrRev(filename, ".")) & "jpg"
' Make sure the specified file exists.
If Dir(filename) = "" Then
MsgBox "The file """ & filename & """ does not exist."
Exit Sub
End If
' Create the embedding.
Dim oleReference As ReferencedOLEFileDescriptor
Set oleReference = doc.ReferencedOLEFileDescriptors.Add(filename, kOLEDocumentEmbeddingObject)
' Set the name in the browser.
oleReference.DisplayName = Mid$(filename, InStrRev(filename, "\") + 1)
End SubIf you've already captured the check-in event within Inventor, there's no reason why you couldn't get Inventor to also add the created .pdf files as OLE attachments to the Inventor file itself which in turn will attach them to the Inventor file once it's in the Vault - in much the same way as images are attached..
I would advise asking the user if they want to create/attach .pdf files each time as it would get extremely irritating if you had to wait for this to complete every time you checked a file in.
In fact, you could simply filter for a specific file type and only then prompt the user for .pdf creation.
EDIT: A colleague just asked me what happens to an existing attachment if/when it gets updated by publishing a new version. I guess it would need to be removed and re-attached within Inventor before being returned to the Vault?

