Today, we look at a couple of BIM360 and cloud related issues:
Additional motivation is provided by this quote of the day:
Today, most software exists, not to solve a problem, but to interface with other software.
Ian Angell
Especially applicable to Forge, BIM360, Design Automation for Revit, and all the other cloud-based workflows evolving today.
People no longer need to buy amplifiers or players of any kind, or lay any wires at all – modern loudpeakers can be driven straight from the Internet, grab the music tracks to play from there, communicate via WLAN or Bluetooth, and be controlled through a smartphone app.
Imagine streamlining and automating building construction and maintenance in a similar fashion.
Significant parts of these tasks are still hands-on, of course; however, an inordinate amount of effort is wasted by inefficient and outdated management processes driving (or failing to) those hands-on parts of the job.
Question: In order to upgrade to the current version of Revit, we have to migrate our files from BIM360 Teams to BIM360 Docs. Since we have hundreds of documents, I am looking to automate this process as much as possible.
The Forge API allows me to download all Revit files from BIM360 Teams. I am also able to upgrade them all to Revit 2019, using either the Revit API or a third party app such as this bulk file upgrader.
Using the Forge BIM360 API, I am able to create new projects programmatically, and upload the files and folders from the Team Drive. The step that I am having difficulty accomplishing in an automated fashion is to initiate collaboration for the upgraded Revit 2019 files. Is there a way that this can be accomplished with either the Revit API or the Forge API? Or is there another way that allows me to automatically accomplish the migration between these two Autodesk Cloud Collaboration solutions?
I came across this tutorial on publishing models that suggests that one needs to manually initiate collaboration for each Revit file through the Revit UI. I hope to find an alternative solution to this suggestion.
Answer:
This issue sounds similar to the one raised in the Revit API discussion forum and escalated to the ADN case 14906646 old topic brought back – changing link paths to cloud paths.
The development team are discussing this issue (ticketed as REVIT-140793) and suggested a possible workaround:
Revit 2019.2 and future releases include support for the "Single user workflow"; that is the non-workshared cloud model. At the same time, they expose the API to initiate the non-workshared cloud model and convert the non-workshared cloud model to a workshared cloud model (C4R).
So, I think you can use the single user APIs to workaround the cases you mentioned as follows:
Document.SaveAsCloudModel
.Document.EnableCloudWorksharing
.My colleague Eason Kang, 康益昇, now confirmed that you can indeed use these steps to achieve your goal.
Here is his report, including the solution to a credentials issue on the way:
Question: I would like to save a local RVT to my BIM360 account – with Design Collaboration service activated – using the Revit 2020 API, but Revit always throws an exception saying that I do not have the required access rights. I have a valid C4R license and able to open C4R models from the folder id I passed to the API with the Revit UI. What is missing?
This is the code snippet:
doc.SaveAsCloudModel( "urn:adsk.wipprod:fs.folder:co.8rtX03jDQXKnssA1FfrEXw", doc.Title);
It throws an exception:
Answer: You need to have the 'Cloud Models for Revit' entitlement set up in manage.autodesk.com
.
Response: Thank you for clarifying. I confused the 'Cloud Models for Revit' with the C4R, and I didn't have the 'Cloud Models for Revit' entitlement set up in my manage.autodesk.com.
Answer: 'Cloud Models for Revit' is a new service provided since Revit 2019.2. It is part of the Revit and Revit LT subscription.
Btw, the major difference to the C4R models is that only one user at a time can work on the model created by this method.
Response: Great!
I set up my Revit subscription as required, followed the steps shared above by Jeremy and confirmed that it works!
Here is my test code implementing this:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.Attributes; using Autodesk.Revit.DB; using Autodesk.Revit.UI; using Autodesk.Revit.UI.Selection; namespace adsk.c4r { [Transaction( TransactionMode.Manual )] public class Command : IExternalCommand { public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements ) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Application app = uiapp.Application; string template = app.DefaultProjectTemplate; string filename = @"D:\DevZone\ADN\t5021\revit_api_c4r_test_6.rvt"; string name = System.IO.Path.GetFileName( filename ); Document doc = app.NewProjectDocument( template ); doc.SaveAs( filename ); try { doc.SaveAsCloudModel( "urn:adsk.wipprod:fs.folder:co.aCd1tMmrTxucmJcmtYTLBQ", name ); var cloudPath = doc.GetCloudModelPath(); if( doc.CanEnableCloudWorksharing() ) { doc.EnableCloudWorksharing(); } TaskDialog.Show( "Revit", string.Format( "{0} is a C4R model now", name ) ); doc.Close(); uiapp.OpenAndActivateDocument( cloudPath, new OpenOptions(), false ); } catch( Exception ex ) { System.Diagnostics.Trace.WriteLine( ex.Message ); return Result.Cancelled; } return Result.Succeeded; } } }
Many thanks to Eason for confirming this procedure!
Eason published another blog post on a related topic, on BIM360 Docs: Setting up external references between files (Upload Linked Files).
The Forge Model Derivative API provides the ability to translate composite models (i.e., multiple models linked by xRefs or external links) into a single Forge Viewer model (the SVF) by uploading a ZIP file containing the host model and its links and passing both
rootFilename
andcompressedUrn
parameters to thePOST
job request payload.What If we want to achieve the same goal on BIM360 Docs? How can that be achieved? BIM360 Docs currently doesn't support the ZIP file format translation.
Fortunately, the BIM360 Docs Web UI provides a function called "Upload Linked Files". The Forge API support a similar functionality.
So, let's see how magic it is!
...
For the full story, please refer to Eason's clear explanation on the blog.
Looking at something related to the end user aspects of BIM for a change, instead of just focussing at the Revit API, I read an informative, provocative and amusing recommendation by Jay B Zallan On Putting the ‘I’ Into Revit, BIM | 01: getting rid of text:
Why do we want No Text? One reason is that if the information is not embedded into a corresponding object (as long as one exists, lol), it is not BIM. That is called drafting and has no place in Revit or BIM. It is and would be like putting hay into the gas tank of a Ferrari... a little tinge of "well, we’ve always done it that way and it always worked fine fuelling the horses" ...need I speculate as to how that Ferrari is doing?
Back to programming, especially cloud based, an inspiring resource lists a huge number of other resources:
Free for developers – on GitHub – provides an extensive list of SaaS, PaaS and IaaS offerings that have free tiers of interest to devops and infradev.
Developers and open source authors now have a massive amount of services offering free tiers, but it can be hard to find them all in order to make informed decisions.
One important aspect as many move to ever more cloud usage and presence is the issue of data collection and tracking.
On this topic, I found the 10 tips to avoid leaving tracks around the Internet an interesting read, and the TunnelBear VPN looks like a useful option; it encrypts your Internet connection to keep your online activity private on any network, providing a slightly more secure way to browse the web.
One final item that caught my eye in the past few days is this seven-minute presentation on quantum computers explained and limits of human technology by Kurzgesagt – in a nutshell:
Have fun pondering your own desktop API and cloud-based solutions and have a wonderful week of fruitful, creative programming!