Сообщество
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.
отмена
Отображаются результаты для 
Показать  только  | Вместо этого искать 
Вы имели в виду: 

Get Securityheader from Vault Login in AutoCAD

8 ОТВЕТ 8
РЕШЕНО
Ответить
Сообщение 1 из 9
ellmag
3152 просмотров, 8 ответов

Get Securityheader from Vault Login in AutoCAD

I wonder if it is possible to get the securityheader from a Vault login in AutoCAD in the same way as in Inventor. In Inventor I add a reference to Connectivity.InventorAddin.EdmAddin.dll but I can' find a similiar reference for AutoCAD.  I have an AutoCAD add-in (written in .NET) that needs to fecth information from Autodesk Vault.

8 ОТВЕТ 8
Сообщение 2 из 9
Redmond.D
в ответ: ellmag

I believe there is another back-door for getting this information inside AutoCAD.  Like with the Inventor add-in, there is no official support for this technique.

 

If you use the following code from your add-in, you should be able to get the userId and ticket of the current Vault session.

 

if (VaultExplorerAppBase.Instance == null)

{

    throw new ApplicationException("Unable to get Vault connection");

}

VaultConnectionManager connectionMgr = VaultExplorerAppBase.Instance.VaultManager;

 

if (connectionMgr.Connection.IsSignedIn() == false)

{

    throw new ApplicationException("Vault connection doesn't exist.");

}

IWebServiceCredentials credentials = new UserIdTicketCredentials(connectionMgr.Connection.SecurityContext.RemoteHost,

  connectionMgr.Connection.SecurityContext.KnowledgeVault,

 connectionMgr.Connection.SecurityContext.UserID,

 connectionMgr.Connection.SecurityContext.Ticket);

 

 

It has dependency on following dlls (which are located in AutoCAD installation directory).  None of these DLLs are part of the supported Vault API.

Connectivity.Application.VaultBase.dll

Connectivity.Common.dll

Connectivity.Common.Vault.dll

Connectivity.Explorer.Framework.dll

Connectivity.Proxies.utils.dll



Doug Redmond
Software Engineer
Autodesk, Inc.

Сообщение 3 из 9
Balaji_07
в ответ: ellmag

Hi Doug,

 

        I need to add a job to Job Processor from AutoCAD (Eg: Publish a drawing file). I have configured jobs and it was working fine with Inventor. Is it possible to do the same with AutoCAD. 

 

       I have gone through your post "http://forums.autodesk.com/t5/Autodesk-Vault-Customization/Get-Securityheader-from-Vault-Login-in-Au... Got no idea in acheiving my functionality.

 

       Can you provide some samples or reference documents to get vault instance from AutoCAD.

 

Thanks,

Balaji A

Сообщение 4 из 9
Anonymous
в ответ: Redmond.D

I would like to use the code from above but I get the folowing error message:

Error 1 'Connectivity.Common.Vault.VaultConnectionManager' does not contain a definition for 'connection' and no extension method 'connection' accepting a first argument of type ....

 

How can I solve this issue, or is there an other way to check/use the current connection from the user in AutoCAD?

Сообщение 5 из 9
wayne.brill
в ответ: Anonymous

Hi,

 

For 2014 a different call needs to be made. I asked a colleague about this. Here is an excerpt of their reply:

 

>> >>

To get the connection the add-in is using, they can access the Connectivity.Application.VaultBase.ConnectionManager.Instance.Connection property. This will return the active connection that the Vault add-in is using at that time. If the add-in does not have a valid connection when this property is read, then I believe it will return null.

 << << 

 

I tested this out and made a blog post about it. (with an VB.NET AutoCAD project for download)

http://adndevblog.typepad.com/manufacturing/2013/09/autocad-2014-vault-add-in-connection.html

 

 

Thanks,



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Сообщение 6 из 9
Anonymous
в ответ: wayne.brill

Hi Wayne,

 

Verry nice blog item.

I've edited the code to have a function that will return the connection or nothing instead.

Imports ADCFWV = Autodesk.DataManagement.Client.Framework.Vault
Module mod_LogIn
    Public Function GetMyVaultConnection() As ADCFWV.Currency.Connections.Connection
        Dim MyConnection = Connectivity.Application.VaultBase.ConnectionManager.Instance.Connection
        If Not MyConnection Is Nothing And MyConnection.IsConnected Then
            Return MyConnection
        Else
            Return Nothing
        End If
    End Function
End Module

 Regards

 

Peter

Сообщение 7 из 9
rhesusminus
в ответ: Anonymous

I'm trying to do this with Vault 2016, but there seems to have been some changes in the API...

Anyone knows how to update this code?


Trond Hasse Lie
AutoCAD Electrical and EPLAN expert
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. :подмигивающее_лицо:
Сообщение 8 из 9
Balaji_07
в ответ: rhesusminus

Hello Trond,

 

You can retrieve Vault connection in ACAD 2016 using the following code

 

Add reference to "Connectivity.Application.VaultBase" from AutoCAD installation folder.

 

 Autodesk.DataManagement.Client.Framework.Vault.Currency.Connections.Connection con = Connectivity.Application.VaultBase.ConnectionManager.Instance.Connection;

 

(code is same as Peter has posted, post more info on the error you receive)

 

Thanks,

Balaji A

 

Accept this post as Solution if  you found it usefull and do not forget to hit Kudos! Smiley Wink

Сообщение 9 из 9
rhesusminus
в ответ: Balaji_07

Thank you. Works like a charm :слегка_улыбающееся_лицо:
Searched the Vault SDK help file, but didn't help much :слегка_улыбающееся_лицо:


Trond Hasse Lie
AutoCAD Electrical and EPLAN expert
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. :подмигивающее_лицо:

Не нашли то, что искали? Задайте вопросы в сообществе или поделитесь своими знаниями.

Новая тема  

Autodesk Design & Make Report