Link IFC Files stored in BIM360 using RevitLinkType.CreateFromIFC

Link IFC Files stored in BIM360 using RevitLinkType.CreateFromIFC

victor.bastidas
Enthusiast Enthusiast
319 Views
3 Replies
Message 1 of 4

Link IFC Files stored in BIM360 using RevitLinkType.CreateFromIFC

victor.bastidas
Enthusiast
Enthusiast

Good day everyone!

 

As the title says, I'm using Revit 2022, and some other different software. 

 

I have access to APS information, and hence I can access ModelGUIDs published using the Get_Items method from APS. When it's a Revit Cloud model I can access to the ModelGUID and then pass it into Revit API, something that looks like this: 

 

 

link_model_id=Guid.Parse(model_guid)

link_path=ModelPathUtils.ConvertCloudGUIDsToCloudPath(ModelPathUtils.CloudRegionUS,project_id,link_model_id)

link_load_result = RevitLinkType.Create(doc,link_path, RevitLinkOptions(False))

doc.GetElement(link_load_result.ElementId).AttachmentType=AttachmentType.Attachment

RevitLinkInstance.Create(doc,link_load_result.ElementId)

 

 

We want to link those files now, as just plain IFC files that are already being stored on BIM360, It can be done manually, but since we have hundreds of those models I want to run a program that checks all the links, their status, if there's a new IFC file that's not linked, to add it, if one was delete it, to delete it so there are no errors when opening those Revit Cloudshared Models. 

 

So, for this method:

public static LinkLoadResult CreateFromIFC(
	Document document,
	string ifcFilePath,
	string revitLinkedFilePath,
	bool recreateLink,
	RevitLinkOptions options
)

Or this one: 

 

public static LinkLoadResult CreateFromIFC(
	Document document,
	ExternalResourceReference resourceReference,
	string revitLinkedFilePath,
	bool recreateLink,
	RevitLinkOptions options
)

I'm really not sure how to use the ExternalResourceReference. 

 

I tried inspecting the element on BIM360 using APS API, but there's no GUID for IFCs. How can I link and manage those files from BIM360?

 

Thanks for your help and hope you have a nice day!

0 Likes
320 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

Sorry to have to mention this, but I believe that some pretty fundamental improvements and simplifications were made in the connection between the Windows desktop Revit API, BIM360, and other APS components in the last year or two. Hence it would probably save you a lot of time and effort if it were possible to use the Revit 2024 API instead of Revit 2022. I have not worked much in that area myself, so I cannot answer your question off-hand, though.

  

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

jeremy_tammik
Alumni
Alumni

I searched StackOverflow for your for CreateFromIFC:

  

  

That turned up the following:

How to link IFC with Revit Design-Automation

  

https://stackoverflow.com/questions/74344678/how-to-link-ifc-with-revit-design-automation

  

Note that APS-related issues are discussed more on StackOverflow than here in the desktop-focused forum.

  

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

victor.bastidas
Enthusiast
Enthusiast

Hi Jeremy! 

 

Thanks for replying. 

 

At our company, we have rolled out Revit 2022 for current projects, up until last year we were using Revit 2020, so we're always using an older Revit version (since projects take a lot of time to be developed). Hopefully this will be easier when we roll our 2024 Revit version. 

 

On the other hand, I had already looked at implementations on stackoverflow, I couldn't find one that used the external reference, since that one is declared on Revit API I decided I'd ask around here 😅

 

In those questions on StackOverflow they're referring to relative paths to the file, that's why they can use a "local resource" with this method:

 

ConvertUserVisiblePathToModelPath

 

I guess, summarizing my question is how to obtain that:

ExternalResourceReference

from APS items.

 

All it says on Revit API is this: 

 

"resourceReferenceType: Autodesk.Revit.DB ExternalResourceReference
An external resource reference describing the source of the IFC file used in creation."

 

I can obtain properties from files in BIM360 it and pass it to Revit, I'm actually using get requests on Revit with a FastAPI server integration that has access to APS, but I can't figure out what ExternalResourceReference I should obtain from APS to link it on Revit. 

 

Given that this method still refers to a local path, I'd assume that maybe there's no possibility to link IFC files from BIM360 using Revit API 2022.

 

For the moment, we'll keep using our older workflow, which was to obtain those IFC Files, Create Revit Cloud Models off of those IFC Files and then link those IFC RVT models into a model container in Revit. (But you can see, it adds more complexity and possibility of errors).

 

Thanks again for having a look, Jeremy! Hopefully this reply broadens my intention on creating those IFC links.

 

Have a nice day!

 

PS. Will you be at any of the September DevCons?

 

 

0 Likes