SaveAsCloudModel method does not save to subfolder

SaveAsCloudModel method does not save to subfolder

Anonymous
Not applicable
1,533 Views
10 Replies
Message 1 of 11

SaveAsCloudModel method does not save to subfolder

Anonymous
Not applicable

Hi!

I am not able to save a revit 2020 model as a cloud model in a subfolder of a BIM 360 project. Is there a way to save it in a subfolder or does it just work with the root folder, "Project Files"? So far, it just works when we input the id of "Project Files" folder.

SAVECLOUDMODEL.png

This is the method I am using: http://www.revitapidocs.com/2020/c72daf7a-43da-a480-d093-e3d6a96d9a76.htm

Thanks,

 

Xavier

0 Likes
1,534 Views
10 Replies
Replies (10)
Message 2 of 11

jeremytammik
Autodesk
Autodesk

Dear Xavier,

 

Thank you for your query.

 

I asked the development team for you.

 

Meanwhile, can you please share a code snippet showing exactly how you are making use of the method?

 

Specifically, what folder id and model name are you using, and from where and how are you obtaining those?

 

Better still would be a complete minimal reproducible case:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

I would be surprised if the development team does not ask for more details before answering  🙂

 

Thank you.

 

Best regards,

 

Jeremy

 



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

0 Likes
Message 3 of 11

Anonymous
Not applicable

Thanks for your reply @jeremytammik! We are also using the design automation v3 for this quick test as well, but it is running locally for now. This workflow is going to help us close the cycle from ordering a prototypical model in a web app, creating the project (BIM 360 api), inviting users, creating folder structure to setting up(upload) the models from a pool of options based on the user request.

We were surprised that we only have to pass a folder id as an argument. We were expecting to pass the BIM 360 project id as well. 

Please, see code below and let me know if you need more information:

using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using DesignAutomationFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CollaborateModel
{
    [Regeneration(RegenerationOption.Manual)]
    [Transaction(TransactionMode.Manual)]
    class CollaborateModel : IExternalDBApplication
    {
        public ExternalDBApplicationResult OnShutdown(ControlledApplication application)
        {
            return ExternalDBApplicationResult.Succeeded;
        }

        public ExternalDBApplicationResult OnStartup(ControlledApplication application)
        {
            DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent;
            return ExternalDBApplicationResult.Succeeded;
        }

        public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e)
        {
            e.Succeeded = true;
            UploadRevitFile(e.DesignAutomationData);
        }

        public void UploadRevitFile(DesignAutomationData data)
        {
            Console.Write(data);
            Document doc = data.RevitDoc;

            try
            {
                //Save as cloud model in specified folder id (does not work for subfolders)
                doc.SaveAsCloudModel("urn:adsk.wipprod:fs.folder:co.gdp9cdmPTjS1BrKsMxQtMw", "modelname");
                //make cloud model workshared in BIM 360 Document Management
                doc.EnableCloudWorksharing();
            }
            catch (Exception e)
            {
                Console.Write(e);
                throw;
            }
            
        }
    }
}

Thanks!

Xavier

0 Likes
Message 4 of 11

Anonymous
Not applicable

The development team has not contacted me, yet. However, I think the reason for not allowing passing a folderId as an argument other than the "Project Files" folder is because the C4R/BIM360Design/Live models are hosted in a different place than the files in BIM 360 Document Management (web browser). For instance, when we sync in Revit, we do not see sub-folders in the file path. We can also refer to the old blog post from @mikako_harada. See image below.  

saveascloud subfolder.png

0 Likes
Message 5 of 11

EliRenzer
Participant
Participant

although CanEnableCloudWorksharing()  is crashing revit the upload is working for me,

saved in Project Files\folder0\folder1 and Project Files\folder0\folder1\folder2

 

let folderId = "urn:adsk.wipprod:fs.folder:co.<--ID-HASH-HERE-->"
let modelName = doc.Title

doc.SaveAsCloudModel(folderId, modelName) // WHEN WORK SHARED PROJECTS WILL BE SUPPORTED?

if doc.CanEnableCloudWorksharing() then
doc.EnableCloudWorksharing()

 

notice two files with the same name not allowed (because all files in c4r are in one folder)

 

----- off topic

collabration for revit is sort of revit server when docs is sort of forge

in c4r was all files in root folder, but docs have a sub folders,

they are linked by file guid,

so scenario like this can happen

if you will copy file1 from one subfolder to another folder and rename it to file2 all projects that where linked to file1 are now linked to file2

 

also in cloud manage dialog gui there is no sub folders as well

 

----- off topic

0 Likes
Message 6 of 11

Anonymous
Not applicable

Thanks for your reply @EliRenzer 

When I use a sub-folderId, Revit just keeps processing, but never completes the upload. I wonder if I just have not waited enough time to let it finish. However, if I use the Project Files folderId, it is pretty fast.

 

The other thing I might be doing different is that I am emulating as if it is running on forge design automation v3.

No idea when workshared models are going to be supported, but this is my way around. We could open as detach to prevent errors.

 

PD. I understand the off topic explanation. Thanks!

X

0 Likes
Message 7 of 11

Anonymous
Not applicable

Hi! I am back on this topic since we have more R2020 projects. 

@EliRenzer We were able to do the collaborate to cloud to a different folder other than "Project Files". It just takes longer. We tested locally, but we are having issues on the live test.

@jeremytammik I am not sure if the dev team contacted you. They did not follow up on my side.

 

It works locally. However, we uploaded the app for testing on the cloud and we got this error:err.PNG

It refers to the "InvalidOperationException" here:

https://www.revitapidocs.com/2020/c72daf7a-43da-a480-d093-e3d6a96d9a76.htm

errcloud.PNG

Based on this, I think Revit IO does not know what to do since you need to have BIM360 Design licence seat to do the cloud work-sharing collaboration. Obviously, there is no way to enter my autodesk credentials and use them in the revit instance that Revit IO uses. 

 

I would love to hear if there is a solution to this.

 

Thanks!

Xavier

0 Likes
Message 8 of 11

jeremytammik
Autodesk
Autodesk

Dear Xavier,
 
You referred to an 'old blog post by Mikako Harada'. Do you have a pointer for that, please?

  

Have you looked for any answers to this on StackOverflow? BIM360 and Forge issues are discussed there, for instance initiating BIM360 Docs collaboration programmatically:

 

https://stackoverflow.com/questions/53892870/initiate-bim360-docs-collaboration-programmatically
 
I will ask Mikako and some more BIM360 savvy colleagues to take a look at this thread as well.
 
Best regards,
 
Jeremy

 



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

0 Likes
Message 9 of 11

Anonymous
Not applicable

Dear @jeremytammik 

 

The blog post is not that relevant. It is about the difference bw bim 360 and collaboration for revit. 

 

I just came across the revit restrictions for Design Automation. 

https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/restrictions/

 

The last two items are about cloud models. Could you confirm that this is the reason?

Notice that we are not trying to access a bim 360 cloud model, we want to upload it to a bim 360 project.

errcloudmd.PNG

The plugin it is definitely failing at SaveAsCloudModel()

 

Thanks,

Xavier

0 Likes
Message 10 of 11

jeremytammik
Autodesk
Autodesk

Dear Xavier,

 

Thank you for your update and perseverance.

 

Yes, I think you hit the nail on the head with this.

 

Afaik, one even more crucial piece of functionality that is missing in that list is network and Internet access:

 

Your DA4R add-in has no access whatsoever to any network and Internet.

 

Hence, how can it log in, upload or download anything at all?

 

Sorry that I did not get you to that point earlier on.

 

Thank you for researching so well for yourself.

 

Best regards,

 

Jeremy

 



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

0 Likes
Message 11 of 11

jeremytammik
Autodesk
Autodesk

Dear Xavier,

 

By the way, I just discovered that I have good news on this topic for the future.

 

I just encountered this note in an internal discussion:

 

[Q] Can you let me know the status of two highly requested features for DA4R: (1) PDF printer; (2) update Revit cloud worksharing model.

 

[A] Both these features are in our roadmap. We do not have estimated release dates for them. They remain high priorities.

 

Best regards,

 

Jeremy

 



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

0 Likes