Vault And Python

Vault And Python

Anonymous
Not applicable
2,927 Views
17 Replies
Message 1 of 18

Vault And Python

Anonymous
Not applicable

Hi

   Can i use python to interact with Autodesk vault ?   If yes can you tell me where i can get the information do to it ? 

 

Thank

0 Likes
Accepted solutions (1)
2,928 Views
17 Replies
Replies (17)
Message 2 of 18

ihayesjr
Community Manager
Community Manager

Vault is not supported with Python.




Irvin Hayes Jr
Principal Product Manager
Autodesk, Inc.

Vault - Under the Hood Blog
0 Likes
Message 3 of 18

Anonymous
Not applicable

Hello 

 

 I know your answer was in 2016. What about 2019? Still do not support Python?

 Thanks

 

Juan


@ihayesjr wrote:

Vault is not supported with Python.



@ihayesjr wrote:

Vault is not supported with Python.


 

0 Likes
Message 4 of 18

ihayesjr
Community Manager
Community Manager

We have no plans to support Python in current or future releases.




Irvin Hayes Jr
Principal Product Manager
Autodesk, Inc.

Vault - Under the Hood Blog
0 Likes
Message 5 of 18

Anonymous
Not applicable
0 Likes
Message 6 of 18

Anonymous
Not applicable

Does anybody know whether it's possible to work around the lack of Python support and use Python anyway?


Perhaps by calling the Vault .NET libraries from Python?


I might try this soon as I wasn't able to get anything working with .NET in Visual Studio. Not even the examples.

0 Likes
Message 7 of 18

spascual
Collaborator
Collaborator

Hi gmeinders,

Recently we have developed a connector between Odoo and Autodesk Vault Pro in order to retrieve data from Item Master. Using Web Services this connector has been entirely developed in Python.

https://forums.autodesk.com/t5/vault-customization/odoo-vault-pro-connector/td-p/8751186

 

I have some videos for the usability.

https://youtu.be/OjCCydzATmw

If need more info, contact me.

 

0 Likes
Message 8 of 18

Anonymous
Not applicable

For others interested in using Python syntax to access Vault, IronPython can be used for this.


I did some tests and it seems to be working (there are 0 examples online though).


Now what I need is VDF documentation which I can't find anywhere. Can anybody point me in the right direction for documentation that shows the entire VDF API, methods, arguments, what the methods return, objects, etc? All I can find are very limited examples and very general explanations.


Where's the API documentation hidden? I found some info in the XML files that come with the VDF dll's, but there must be something better?


PS: can someone please fix this forum for Firefox? The useless "Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied." error is driving me kind of nuts. Had to switch to Edge to use this website?! 

0 Likes
Message 9 of 18

asmeltzer
Contributor
Contributor
0 Likes
Message 10 of 18

cavallerin
Enthusiast
Enthusiast

Hi, it seems links are not more available, could you please post new ones? Thanks

 

0 Likes
Message 11 of 18

tomas.pascual
Enthusiast
Enthusiast
0 Likes
Message 12 of 18

tomas.pascual
Enthusiast
Enthusiast

We already have a python script in Excel that retrieve data from vault based on itemNumber.

Regards,

Message 13 of 18

cavallerin
Enthusiast
Enthusiast

Hi,
I'm sorry, but haven't checked till now this thread.
Well is it possible to share with me how you managed to connect to the Vault?


Thx!

0 Likes
Message 14 of 18

tomas.pascual
Enthusiast
Enthusiast
Accepted solution

Hi Cavallerin,

Sure,

 

# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import xlwings as xw
import zeep


@xw.sub
def main():
    client = zeep.Client(wsdl=url)
    sign_in = client.service.SignIn(userName='######', userPassword='######', knowledgeVault='######')
    token = sign_in.Authorization
    user_id = sign_in.User.Id
    wb = xw.Book.caller()
    numbers = wb.sheets[0].range('C2').expand('down')
    i = 1  # Indice para recorrer columnas, uno menos que el range de numbers

    # Acceso al servicio de Artículos
    settings = zeep.Settings(extra_http_headers={'Authorization': token})
    client_item = zeep.Client(wsdl=url_item, settings=settings)

    # Acceso al servicio de Propiedades
    client_prop = zeep.Client(wsdl=url_prop, settings=settings)
    for rec in numbers:
        i = i + 1
        GetVaultItems = client_item.service.FindItemRevisionsBySearchConditions(
            searchConditions={'SrchCond': {'PropDefId': 31,
                                    'SrchOper': 3,
                                    'PropTyp': 'SingleProperty',
                                    'SrchRule': 'Must',
                                    'SrchTxt': rec.formula,
                                    }},
            bRequestLatestOnly=True,
        )
        if GetVaultItems.searchstatus.TotalHits == 1:
            Title = GetVaultItems.FindItemRevisionsBySearchConditionsResult.Item[0].Title
            Id = GetVaultItems.FindItemRevisionsBySearchConditionsResult.Item[0].Id
            GetVaultItemsCustomProperties = client_prop.service.GetProperties(
                entityClassId='ITEM',
                entityIds={'long': Id},
                propertyDefIds={'long': [37, 141, 165, 171, 172]},
            )
            Units = GetVaultItemsCustomProperties[0].Val
            SapMatGr = GetVaultItemsCustomProperties[1].Val
            SapMatTy = GetVaultItemsCustomProperties[2].Val
            Aprov = GetVaultItemsCustomProperties[3].Val
            AprovEsp = GetVaultItemsCustomProperties[4].Val
        else:
            Title = '####'
            SapMatGr = '####'
            SapMatTy = '####'
            Aprov = '####'
            AprovEsp = '####'
            Units = '####'
        if not wb.sheets[0].range('D' + str(i)).value:
            wb.sheets[0].range('D' + str(i)).value = Title
        if not wb.sheets[0].range('E' + str(i)).value:
            wb.sheets[0].range('E' + str(i)).value = SapMatGr
        if not wb.sheets[0].range('F' + str(i)).value:
            wb.sheets[0].range('F' + str(i)).value = SapMatTy
        if not wb.sheets[0].range('G' + str(i)).value:
            wb.sheets[0].range('G' + str(i)).value = Aprov
        if not wb.sheets[0].range('H' + str(i)).value:
            wb.sheets[0].range('H' + str(i)).value = AprovEsp
        if not wb.sheets[0].range('I' + str(i)).value:
            wb.sheets[0].range('I' + str(i)).value = Units


if __name__ == "__main__":
    xw.books.active.set_mock_caller()
    main()
Message 15 of 18

cavallerin
Enthusiast
Enthusiast

Hi and thx a lot!
I'm always late on checking replies as I'm deeply involved in CAD-PDM integration process.
Thx again, I'll give it a check.
Regards!

0 Likes
Message 16 of 18

tomas.pascual
Enthusiast
Enthusiast

Hi Cavallerin,

There is a new vault rest api which can be accesed easylly from https

https://aps.autodesk.com/developer/overview/vault-data-api

0 Likes
Message 17 of 18

cavallerin
Enthusiast
Enthusiast

 

# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import xlwings as xw
import zeep


@xw.sub
def main():
    client = zeep.Client(wsdl=url)
    sign_in = client.service.SignIn(userName='######', userPassword='######', knowledgeVault='######')
    token = sign_in.Authorization
    user_id = sign_in.User.Id
    wb = xw.Book.caller()
    numbers = wb.sheets[0].range('C2').expand('down')
    i = 1  # Indice para recorrer columnas, uno menos que el range de numbers

    # Acceso al servicio de Artículos




Hi Tomas,
thx a lot! I have been able to retrieve data from Vault.


0 Likes
Message 18 of 18

tomas.pascual
Enthusiast
Enthusiast

Amazing !!!

0 Likes