Today, we share Naveen Kumar T's first Revit API blog post, an important solution to fix a problem loading BIM 360 links, and lots of tools and advice on programming Revit add-ins in general:
- New Revit material appearance asset
- BIM 360 links not found solution
- AppStore guidelines for Revit add-in
- Coding Revit add-ins the e-verse way
- VS wizard template location
New Revit Material Appearance Asset
Naveen Kumar T shared a blog post in
the DAS AEC DevBlog showing
how to set AppearanceAsset
properties of a newly created Revit material.
Many thanks to Naveen, and looking forward to many future posts.
BIM 360 Links Not Found Solution
Luiz Henrique @ricaun Cassettari shared a helpful BIM 360 links not found fix:
A user reports to me that some of my plugins had problems with BIM360 links; after testing a lot of things, I found out what is causing the problem. It's a known problem here in the forum. It is caused by referencing a higher version of the Newtonsoft.Json
package.
In Revit 2021, the default version of Newtonsoft.Json
is 11; when an application or plugin requests to load Newtonsoft.Json
version 13 and it is not found in the plugins folder, something strange happens.
Instead of ignoring and using the already loaded Newtonsoft.Json
version 11, for some reason, Revit loads a Newtonsoft.Json
file from the Autodesk PnIDModeler
add-in, and it is a version 11.
Now, if you have two copies of Newtonsoft.Json
with the same version loaded in Revit, when BIM360 tries to initialize (usually happens when you open a Revit file that requires BIM360), it will throw an exception in the Journal and the BIM360 service fails. Without the service, Revit can't load BIM360 link. It displays this message:
A quick fix would be to remove or change the name of the Newtonsoft.Json.dll
file in the Autodesk PnIDModeler
add-in.
Or, if you are a developer using an old version like version 9, it should work; Revit will load the default version instead. But if you need to use a specific version of Newtonsoft.Json
, be aware that it could cause some issues in Revit.
Here is Luiz' seven-minute video explanation on how to fix BIM360 link not found problem:
Related references:
- BIM 360 "Linked document is not found" error
- BIM 360 Links issue
- archi+lab DLL Hell is Real
- Newtonsoft Json.dll Version Conflict
Many thanks to Luiz Henrique for documenting and sharing this important solution!
AppStore Guidelines for Revit Add-In
Now, let's move on to some generic add-in hints: if you are thinking about programming a Revit add-in at all, and especially if you are thinking about the AppStore, you should check out the AppStore guidelines and its numerous useful general development recommendations:
Coding Revit Add-Ins the E-Verse Way
Going much further and on into the modern development process, a comprehensive guide explaining more complex and intricate aspects of Revit add-in coding is presented by Francisco Maranchello of e-verse in his article on coding Revit add-ins the e-verse way, saying:
I'm an architect and coder and have worked on many Revit addins these past few years, alongside other stuff like recently building and scaling e-verse. I wanted to share an article we recently published on our blog to see if it could help the community, shedding some light on the structure we use for Revit addins: blog.e-verse.com/build/coding-revit-add-ins-the-e-verse-way. I know you've covered this subject and shared many templates over the years since I've been a reader of The Building Coder for a while now, so I figured maybe we could contribute to that if you find anything you think can add value there. There's more to come as well. Thank you!
Francisco covers the complete add-in ecosystem including:
- Git code repository
- A .NET framework solution containing multiple projects
- NuGet dependencies
- Post-build events for debugging and releasing
- A configuration file to manage settings and environment variables outside the main logic
- CI/CD pipelines leveraging GitHub Actions
Very many thanks to Francisco for sharing his experience and in-depth advice!
VS Wizard Template Location
One of the templates mentioned above is the very simple and minimal Visual Studio Revit add-in template for C# and VB.
I recently resolved an issue I had getting it to work on my system using Parallels on the Mac. My template was displayed, and I had a hard time discovering why. For instance, the thread on how to fix Visual Studio when templates disappear from your Add New Item dialogue did not help.
Finally, I discovered that the Parallels setup had surreptitiously modified my VS project template location settings:
Once that was understood, the issue was easy to resolve, setting the location back to the default folder on the C: drive.
I also added a corresponding note to the readme for my own and others' future reference.