Today, we look at a request for new ideas for enhancing RevitLookup, implementing a pickpoint rubber band and opening BIMs on ACC Docs:
DirectShape
jigDo you have any ideas for RevitLookup enhancements?
A lot of exciting functionality has already been worked on in the dev and dev_winui branches. We expect to see that coming out quite soon.
Meanwhile, Roman Nice3point opened a discussion for collecting RevitLookup Ideas. Your contributions there are welcome. Thank you!
A couple of ideas on creating transient elements graphics similar to the AutoCAD jig functionality using
the IDirectContext3DServer
functionality or the temporary InCanvas graphics API were recapitulated in
the Revit API discussion forum thread
on drawing line visible on screen:
Lorenzo Virone shared a different approach, creating and deleting database-resident Revit elements on the fly in a loop:
I faced a similar UI problem to create a rubber band between two points.
I used two functions, Line.CreateBound
and NewDetailCurve
, inside a loop to create a line at the cursor position, refresh, and delete the line every 0.1 seconds, until the user chooses the second point.
A little tricky, but it works fine for me, and Revit seems to execute these 2 functions very fast.
This trick will technically work with anything: create new elements on each mouse movement, refresh, delete the created elements and replace them with new ones. You can use either model or detail elements. It's easy to implement, because you just need to call the two methods, e.g., like this:
Many thanks to Lorenzo for sharing this nice solution.
Chuong Ho adds: This technique can also be used with a DirectShape
element:
Many thanks to Chuong Ho for this addition!
We started out discussing opening a cloud model with Revit API in the Revit API discussion forum, but then moved it over to StackOverflow, the better place for such a cloud-related topic, where my colleague Eason Kang explains how to open files located in ACC Docs:
Question: My Visual Studio Revit API add-in open Revit files to export data in a batch. I can add many files which are on the networks and the plugin automatically opens them all. Is it possible to also open files that are in the ACC Docs cloud?
I know I can open AccDocs which were be already downloaded locally by searching for them in the collaboration cache folder, but how to open files which have not yet been downloaded?
Answer: Since you mention the collaboration cache folder, I assume you are using
the Revit Cloud Worksharing model,
a.k.a. C4R
, the model for Autodesk Collaboration for Revit.
If so, you can make use of
the APS Data Management API to
obtain the projectGuid
and modelGuid
in the model version tip like this:
{ "type":"versions", "id":"urn:adsk.wipprod:fs.file:vf.abcd1234?version=1", "attributes":{ "name":"fileName.rvt", "displayName":"fileName.rvt", ... "mimeType":"application/vnd.autodesk.r360", "storageSize":123456, "fileType":"rvt", "extension":{ "type":"versions:autodesk.bim360:C4RModel", .... "data":{ ... "projectGuid":"48da72af-3aa6-4b76-866b-c11bb3d53883", .... "modelGuid":"e666fa30-9808-42f4-a05b-8cb8da576fe9", .... } } }, .... }
With those in hand, you can open the C4R model using Revit API like this:
// where is your BIM360/ACC account based, US or EU? var region = ModelPathUtils.CloudRegionUS; var projectGuid = new Guid("48da72af-3aa6-4b76-866b-c11bb3d53883"); var modelGuid = new Guid("e666fa30-9808-42f4-a05b-8cb8da576fe9"); // For Revit 2023 and newer: var modelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath( region, projectGuid, modelGuid ); // For Revit 2019 - 2022: //var modelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath( // projectGuid, modelGuid ); var openOptions = new OpenOptions(); app.OpenAndActivateDocument( modelPath, openOptions ); // on desktop // on Design Automation for Revit or // to not activate the model on Revit desktop: // app.OpenDocumentFile( modelPath, openOptions );
You can also make use the Visual Studio APS Data Management package on NuGet for this. The Hubs Browser tutorial demonstrates its use.
References:
Many thanks to Eason for this comprehensive answer!
Moving away from Revit and its API to other interesting current news, Daniel Immke suggests that it’s the future – you can stop using JPEGs and presents an overview and rationale for some compelling alternatives, e.g., AVIF and WebP.
Joseph Cox describes how he broke into a bank account with an AI-generated voice – some banks tout voice ID as a secure way to log into your account. He proves it's possible to trick such systems with free or cheap AI-generated voices.