Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Import data exchange model into Inventor

2 REPLIES 2
Reply
Message 1 of 3
Dimitar.Atanasov2VL53
306 Views, 2 Replies

Import data exchange model into Inventor

I found a post in Mod the Machine about importing data exchange models into inventor using VBA.

original post: https://modthemachine.typepad.com/my_weblog/2022/04/import-data-exchange-model.html

Sub ImportDataExchangeComponentSample()
    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim sFdx As String
    sFdx = "https://developer.api.autodesk.com/exchange/v1/exchanges"
    
    Dim sUrn As String
    sUrn = "urn:adsk.wipprod:dm.lineage:**********************"
    
    Dim sUrl As String
    sUrl = sFdx + "?filters=attribute.exchangeFileUrn==" + sUrn
    
    Dim oDEDef As ImportedDataExchangeComponentDefinition
    Set oDEDef = oDoc.ComponentDefinition.ImportedComponents.CreateDataExchangeDefinition(sUrl)
    
    Dim oDEComp As ImportedDataExchangeComponent
    Set oDEComp = oDoc.ComponentDefinition.ImportedComponents.Add(oDEDef)
End Sub

I tried it with a few data exchange models that I have on the Autodesk construction cloud and I don't get a model in inventor.

Has any of you tried it?

Labels (3)
2 REPLIES 2
Message 2 of 3

Funny enough when running the code in the blog post using the urn of an old Data Exchange file I had, I did get the same result: nothing got imported and also got an *.htm file showing an error:

adamnagy_0-1675855099289.png

Maybe I don't have access to that exchange file anymore or something went wrong with it - I don't even know where to look for it. 
Then I used the urn of another Data Exchange file in ACC, and with that the import worked fine:

adamnagy_1-1675855255441.png

Please make sure that you are indeed using the urn of a Data Exchange file, not the original file it was created for, and also open it in ACC to see that it's working fine.



Adam Nagy
Autodesk Platform Services
Message 3 of 3

The problem at my end was that we still use Revit 2022 and Data exchange models can be created from Revit 2023+. Also, I skipped the most important step of actually creating a data exchange model in the ACC.
Initially, I thought that every model in the ACC is readily available to grab with that code and imported into Inventor.

Anyway, when I tested with an actual data exchange model and the code works fine.

 

 

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

Post to forums  

Autodesk Design & Make Report