Open C4R Document Programmatically

Open C4R Document Programmatically

Anonymous
Not applicable
1,347 Views
5 Replies
Message 1 of 6

Open C4R Document Programmatically

Anonymous
Not applicable

Using Revit 2018.

 

I have a C4R project that I open and have pulled out the user-viewable path for: 

 

BIM 360://Admin Project/C4ROpenAndActivateTest.rvt

I read in the docs to use ModelPath for loading server-based files, so I did this:

 

var modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath("BIM 360://Admin Project/C4ROpenAndActivateTest.rvt");
var document = _uiApp.OpenAndActivateDocument(modelPath, new OpenOptions(), false);

Which looks good at first glance, because modelPath.CentralServerPath is set to https://model15.skyscraper.autodesk.com:443/ModelService2015/ModelService.svc/basichttpbuffer, but I get the exception: 

 

The document to be opened does not exist.

and in looking at modelPath, both GetModelGUID() and GetProjectGUID() return Guid.Empty.

 

Am I missing a step somewhere to get the OpenAndActivateDocument() call to open a C4R RVT?

0 Likes
Accepted solutions (1)
1,348 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk
Accepted solution

Currently there is not support for opening a C4R model programmatically.  The best way to access the data (today) is to leverage the Forge API to get at the models in a project.  However, it is important to note that the model that is accessible via the Forge API is “detached” from the “source of truth” which is C4R.

 

Sorry about that.

 

Here are two previous related threads on similar issues:

 

 

Cheers,

 

Jeremy



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

Message 3 of 6

fatm
Participant
Participant

Any news on this topic?

 

We really need to be able to access the C4R and BIM 360 Teams through the API.

 

Has anyone posted this feature in the Ideas Forum?

0 Likes
Message 4 of 6

jeremytammik
Autodesk
Autodesk

Dear @fatm,

 

I recommend reading the thread mentioned above:

 

http://forums.autodesk.com/t5/revit-api/browsing-model-files-in-the-cloud-a360-c4r/m-p/6537130

 

It includes more info on this topic.

 

I don'y know yet whether the Revit Idea entry has been submitted.

 

I brought this up with the development team once again.

 

As mentioned in the other thread, some access is provided via Forge, and it is more complicated than you might expect...

 

Cheers,

 

Jeremy



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

0 Likes
Message 5 of 6

jeremytammik
Autodesk
Autodesk

Update from the development team regarding this question:

 

"We recommend that developers regularly review new APIs available in Revit Preview."

 

🙂

 

Yay!

 

Cheers,

 

Jeremy



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

Message 6 of 6

callumf
Contributor
Contributor

Ive also posted about a workaround to opening a C4R model in this thread, but essentially there is a way to find the local C4R files and open them, sync to central etc.

 

It involves searching through the local journal files, matching GUIDs to Model names, then finding that folder in the local Collaboration cache and opening the Revit project contained in there.

 

Its a bit of a workaround until we get a proper API to achieve this, but its working fine so far.

0 Likes