Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Vault API Documentation\Examples

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
9771 Views, 6 Replies

Vault API Documentation\Examples

Hi all, 

 

I've just started investigating a few VB.NET projects which tie in with the Vault, and I'm struggling to find documentation to assist. I'm still fairly fresh with .NET to start with, but when working with Inventor there's loads of really helpful info to help me out. I've been working through the SDK, and Doug Redmond's blogs, and they answer many questions, but not all. I'm currently working through AU documentation, but I'm spending alot of time chasing what I assume to be fairly simple solutions.

 

What I'm hoping to find is a few simple examples which explain how to access the document object, the documents properties (including Vault properties and iproperties), the thumbnail, and referenced/referencing files. I'd also like to find an object model (similar to Inventors) if possible.

 

If anyone can help out I'd greatly appreciate it.

 

Regards

6 REPLIES 6
Message 2 of 7
Daniel.Dulzo
in reply to: Anonymous

Hello Gerrard,

 

Your question is kind of general, so I'll do my best here to provide some information on where to get you started and perhaps you can post more specific questions later, as they come up. It's good that you are aware of the SDK documentation and Doug's blog, JustOnesAndZeros. To begin with, it might be helpful to get a general feel for what's in the SDK and where to find it. A good place to start are the "Getting Started" articles in the SDK documentation. Those provide some useful information about how to set up an application using the Vault SDK as well as a general overview of Vault's architecture. From there, it might be good to get a feel for the different concepts in the Vault SDK. For this information, Doug's blog articles are useful. He has a "Concepts" category on his blog that contains some useful articles.

http://justonesandzeros.typepad.com/blog/2011/09/entities-and-behaviors.html and http://justonesandzeros.typepad.com/blog/2010/06/properties-in-vault-2011---part-1.html are some specific ones that I would suggest. Also, it's worth noting that Doug's blog has several additional code examples for download that are not packaged with the SDK itself. Finally, I would suggest going back to the SDK documenation and reading the "Web Services" article under the "API Reference" node. The whole SDK is grouped into various "services" and that article provides an overview of what services exist and what they do.

 

Now, on to your more specific questions. I'm not sure what you mean when you say "access the document object", but I assume you mean how to get data about files from Vault? If that's the case, your starting point should be the DocumentService. It contains methods like GetLatestFilesByFolderId() and other useful methods for getting File objects. There are several examples of how to use the DocumentService in the various SDK samples and other samples on Doug's blog. For getting file properties, you'll want to use the PropertyService. Methods like GetProperties() and GetPropertyDefinitionsByEntityClassID() are useful in this regard. More information on them is in the SDK documentation. There are some other posts on the discussion boards here with examples of how to use the property service, as well as information on properties in general on Doug's blog and the knowledgebase articles in the SDK documenation. Accessing the thumbnail for a file is the same as accessing a file's properties because it is a file property. Additional information on how to render the thumbnail data can be found in Doug's blog article here: http://justonesandzeros.typepad.com/blog/2011/05/viewing-thumbnails.html. File references can get tricky, so an overview of how they work can be found on Doug's blog here: http://justonesandzeros.typepad.com/blog/2009/09/file-associations-part-1.html. The specfic methods you're likely to use are on the DocumentService. I would suggest looking at GetFileAssociationsByIds(). It can take a little digging at times, but a lot of information is out there. Good luck!

 

Regards



Daniel Dulzo
Software Engineer
Autodesk, Inc.
Message 3 of 7
Anonymous
in reply to: Daniel.Dulzo

Daniel,

 

Excellent response. 

 

I realise my enquiry is very general, but you've gotta start somewhere. I've read through Doug's blog on Entities, and thumbnails, but the others I haven't. Its a little tough trying to figure out which blogs (or any information for that matter) is relevant until you've got at least a basic understanding of the architecture... but I'll get there.

 

The first project I set myself, was to add a thumbnail window to the SDK Example vault file browser. With Doug's thumbnail blog I figure all I'd need to do was patch the two together. Doug's example you need to provide the PropInst of the file as argument, so I set about trying to figure this out, but just burnt 2hrs going around in circles. In the end, I had this:

 

        For Each PropDef As Autodesk.Connectivity.WebServices.PropDef In m_docSvc.GetAllPropertyDefinitions()
            If PropDef.SysName = "Thumbnail" Then
                Dim ThumbnailProp As Autodesk.Connectivity.WebServices.PropDef = PropDef
                Dim FilePropInst As Autodesk.Connectivity.WebServices.PropInst = m_docSvc.GetProperties({selectedFile.File.Id}, {ThumbnailProp.Id})
            End If
        Next

But I'm getting an error on line Dim FilePropInst which says

 

Value of type '1-dimensional array of Autodesk.Connectivity.WebServices.PropInst' cannot be converted to 'Autodesk.Connectivity.WebServices.PropInst'.

I haven't encountered this one before, and google has been less then helpful. So I don't even know whether I'm on the right track or not...

 

Regards 

 

Message 4 of 7
Daniel.Dulzo
in reply to: Anonymous

Gerrard,

 

You're doing well in terms of identifying the correct service methods to use and your general approach seems sound. I believe your error is because PropertyService.GetProperties() returns an *array* of PropInst objects and the error is telling you that it cannot convert from an array of object to a single object. Try changing the line with the error from:

 

Dim FilePropInst As Autodesk.Connectivity.WebServices.PropInst = m_docSvc.GetProperties({selectedFile.File.Id}, {ThumbnailProp.Id})

To:

 

Dim FilePropInst As Autodesk.Connectivity.WebServices.PropInst() = m_docSvc.GetProperties({selectedFile.File.Id}, {ThumbnailProp.Id})



Daniel Dulzo
Software Engineer
Autodesk, Inc.
Message 5 of 7
Anonymous
in reply to: Daniel.Dulzo

Wow... is that all I was missing?

 

Ok, now that I've crossed that hurdle, I passed that propInst to Doug's GetImage routine, and on the line:

 

        Using ms As New System.IO.MemoryStream(thumbnailRaw)

 I get an exception (see attachment).

 

This one I'm sure is well over my head...

 

The code now that I've changed it is:

 

        Dim FilePropInst As Autodesk.Connectivity.WebServices.PropInst()

        For Each PropDef As Autodesk.Connectivity.WebServices.PropDef In m_docSvc.GetAllPropertyDefinitions()
            If PropDef.SysName = "Thumbnail" Then
                Dim ThumbnailProp As Autodesk.Connectivity.WebServices.PropDef = PropDef
	                FilePropInst = m_docSvc.GetProperties({selectedFile.File.Id}, {ThumbnailProp.Id})
                Exit For
            End If
        Next

        Dim TEST1 As New GDHTest1
        Me.PictureBox1.Image = TEST1.GetImage(FilePropInst(1), 180, 180)

 

Message 6 of 7
Anonymous
in reply to: Anonymous

OK, I just figured out that the previous error I was getting was due to selecting a file which does not have a thumbnail available. I found a file with a known thumbnail, and it worked OK.

 

Now for the next challange...

Message 7 of 7

I wonder if Vault team created an on-line alternative to VaultSDK.CHM  (like Inventor team did by launching http://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-5901102A-F148-4CD4-AF50-26E2AFDEE6A7).

Old School CHMs lacks interface usability.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report