How do I use the Revit API to read ITM files?

How do I use the Revit API to read ITM files?

ccargillAUF8R
Observer Observer
1,347 Views
5 Replies
Message 1 of 6

How do I use the Revit API to read ITM files?

ccargillAUF8R
Observer
Observer

I am trying to create a Revit Add-In that will read ITM files using the Revit API and/or the Fabrication API. The Autodesk Fabrication API contains samples to do this, but when I try to use the same process I am running into a System.AccessViolationException on the line where I try to set the item. Does anyone know how to get around this exception, or what is causing it? Or, is there a way to read ITM files using just the Revit API, and not the Fabrication API? 

 

I have tried multiple different ITM files, so I do not think that the file itself is the problem. 

 

My code: 

 

public static string QueryDatabaseServices()
{
  System.Reflection.Assembly.LoadFrom(@"C:\Program Files\Autodesk\Fabrication 2018\CADmep\FabricationAPI.dll");
  StringBuilder builder = new StringBuilder();
  Autodesk.Fabrication.Item itm1 = null;
  itm1 = Autodesk.Fabrication.Content.ContentManager.LoadItem(@"**file path of ITM file**");
  builder.AppendLine(itm1.Name);
  builder.AppendLine(itm1.CID.ToString());
  builder.AppendLine(itm1.Description);

 

  return builder.ToString();
}

 

I am calling this function from my Revit Add-In, which launches and works fine. 

 

SystemAccessViolationException.PNG

1,348 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

I am checking with the development team for you...

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6

pfernbach
Explorer
Explorer

I am having the same issue. We are trying to read all the properties from the itm file and push them to a database. Any insight on this yet? Thanks in advance. 

Message 4 of 6

Anonymous
Not applicable

I'm facing the same issue, any updates regarding this Exception ?

0 Likes
Message 5 of 6

nbrownRA2ZC
Community Visitor
Community Visitor

This is something I am also trying to do, namely get all of the metadata inside an itm file and eventually store it in a database for a master data management project.  Does this issue still exist?  Has anyone done this successfully?

0 Likes
Message 6 of 6

jeremy_tammik
Alumni
Alumni

I do not have any news on this myself. I checked the Internet and at least discovered that Revit does (or did?) provide some kind of support for ITM:

  

https://knowledge.autodesk.com/support/fabrication-products/learn-explore/caas/CloudHelp/cloudhelp/2...

  

Maybe the Autodesk University class on how to detail and fabricate ITM/Fabrication parts in Revit in less time will help more:

  

https://www.autodesk.com/autodesk-university/ru/class/Detail-and-fabricate-ITMFabrication-Parts-Revi...

  

Please let us know how you end up solving this. Thank you!

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes