Forge Design Automation for Revit or DA4R is really starting to take off.
Let's take a look at some recent topics:
- Display custom properties using DA4R
- Upgrade Revit file version with DA4R
- Logging in a Revit Design Automation add-in
- DA4R input and output files
- CesiumJS open source 3D mapping
- Banksy's wife hates home office
By the way, if you are interested in diving in deeper into DA4R yourself, one of the easiest and most effective way to do so is to join a Forge accelerator. Since they are virtual nowadays, a larger number of developers can participate. Participating actively will guarantee you answers to any questions you may encounter and ensure you have ongoing support for the proof of concept. You might even get your whole application completed right away during the accelerator.
I wish you good luck and lots of fun diving into DA4R!
Display Custom Properties using DA4R
Augusto @augustomaia Goncalves published a nice article on custom properties using Design Automation showing how to implement a Forge viewer extension that displays standard Revit data already available in the RVT model but not handled by the standard Forge translation using DA4R to extract the Revit properties from BIM360 and add them as custom properties to the Forge viewer.
He picked the compound layer structure of walls as an example of pre-existing BIM data to display in Forge.
The sample code is provided in the forge-customproperty-revit GitHub repository.
Upgrade Revit File Version with DA4R
Another recent Forge sample by Zhong @johnonsoftware Wu, forge-upgradefiles-revit, demonstrates how to upgrade Revit project, family and template files to the latest version using Design Automation for Revit, including support for either individual files or entire folder.
Logging in a Revit Design Automation Add-In
In the StackOverflow discussion
on logging in Revit Design Automation add-in,
Rahul Bhobe clarifies that all the add-in's
SystemConsole.WriteLine output is captured in the running workitem's
DA4R Input and Output Files
Another StackOverflow question asks how to pass a text file as input to DA4R:
Question: I developed a Revit add-in that takes 3D point data from a text file as input and creates RVT family files and eventually complex geometry by placing them at the appropriate point coordinates.
The text file looks like this:
1.002, 20,502, 21.706 12.502, 5,502, 7.706 21.002, 15,502, 14.706 ...
I am basically reading the text data as input for creating the family definition. Now, when converting the add-in to use the Design Automation API, I guess I will not be able to continue using this simple text file as input.
My question is, what type of input file should I use to pass the 3D point coordinates described above? Should it be JSON? If it needs to be JSON, then how I should write it to represent these point coordinates?
Answer: The slightly more complex question is how to generate multiple output files.
That is answered by the article on how to generate dynamic number of output with Design Automation for Revit V3.
In passing, it also mentions multiple input files, saying:
... For the zipped input file, it's well documented at https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/step6-post-workitem/, but for the output zipped result, it's not so clear...?
Trying to follow that link, I note that it is out of date.
The updated link that worked for me is forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/step7-post-workitem. Apparently, a new step was added to the tutorial after publishing the original article.
Looking at the Forge documentation and additional notes on input arguments, I see the instructions on how to pass JSON input data directly in the workitem itself.
I would assume that you can also use a different prefix instead of
data:application/json such as
data:application/text to pass in the data in its current form.
Please try that out and let us know how it works for you.
Alternatively, you can just stay on the safe side and convert your text data to JSON format.
There are innumerable ways of doing so.
The most minimalistic and simple would look like this:
[1.002, 20,502, 21.706, 12.502, 5,502, 7.706, 21.002, 15,502, 14.706, ...]
That represents on single array of doubles.
A slightly more structured approach might be to pass in an array of triples of doubles like this:
[[1.002, 20,502, 21.706], [12.502, 5,502, 7.706], [21.002, 15,502, 14.706], ...]
As you see, it is not hard.
Response: Many Thanks Jeremy. All nice help. I am going through it. I will make it JSON, to be on the safe side :)
CesiumJS Open Source 3D Mapping
Moving away from the Revit API and DA4R, I stumbled across this very powerful and beautiful 3D world-wide mapping platform that I want to share with you:
Take a look at the getting started introduction to get a feel for it.
Banksy's Wife Hates Home Office
Let's round off with something non-technical, a new contribution from Banksy, saying, My wife hates it when I work from home: