Saturday, December 3, 2016

RTC 2016 NA – Boost Your BIM's Harry Mattison Granted Revit API Wishes (Updated)

Updated on December 4, 2016: re-ordered in descending order.

From the Boost Your BIM website:

#RTCNA2016 Wish 1 Granted!

Timothy had this API wish:

In Activate View event, If active workset contains “XX”, show task dialog warning user they are about to draw on an incorrect workset. We lock out users from “XX Shared Levels and Grids”, “XX Scope Boxes”, and “XX Links”

For the source code, see this article

#RTCNA2016 Wish 2 Granted! (part one)

Timothy had this API wish:

View Ranges in Section to show graphically like a space in section (with Interior checked on) . Allow me to drag the box up/down to level if desired otherwise keep “Level Above”.

Here is part one – creating lines in an elevation view to show the view range of a plan view.

For the source code, see this article

#RTCNA2016 Wish 2 Granted (part 2)

The previous post showed how to create lines in an elevation view to visualize the view range of a plan view. Now let’s see how to let the user move those lines in the elevation view and update the plan view’s range.

For the source code, see this article

#RTCNA2016 Wish Granted – Load Group from RVT

bd5cents sent in an API wish to:

Load Group in to project from external Group file. .rvt file.

This could be particularly useful if you have a folder full of Group RVTs and want to load them all, or if you want to create a dialog box where the user can select multiple groups to load.

Unfortunately, the API does not have a simple Document.LoadGroup() method, so we have to do a bit more work.

For the source code, see this article

#RTCNA wish granted (sort of) – slab edges on all floor edges

An API wish from Michael

Creating slab edges programmatically for all edges of a slab. The UI does not allow you to pick all edges of a slab in some cases. For example, on a slab edge that is sloping and curving in plan. Is there a way to get around this in the API by hard setting the reference curve?

It turns out that the limitation on sloping/curving edges still exists when we use the API, but in any case, below is the API code to create slab edges on all edges of the floor’s top face.

For the source code, see this article

#RTCNA wish almost granted – clear keynote when duplicating types

Clearing out my RTC API Wishlist Inbox… (do you have more wishes? RTCEUR is coming in 3 months)

Nicklas asks

Is it possible to create a macro that resets keynote when a family is duplicated?

The code and video below shows how Dynamic Model Update can be used to clear the Keynote parameter’s value any time a new Element Type is added to the file. But the problem with this is that it does not distinguish the different ways that a new Element Type can be added.

You can duplicate a type (the scenario that Nicklas wants to capture) but it also triggers when you load a family (a scenario that probably should not clear the keynote values for the just loaded families). The solution to this might include subscribing to the DocumentChanged event and using the GetTransactionNames Method to differentiate between a Duplicate and Load Family.

For the source code, see this article

#RTCNA wish granted – Design Option Set info

Rabi asked

I am curious if you have figured a way to get the Design Options Set from Revit API

Here’s what it seems we can do with the parameters OPTION_SET_ID and PRIMARY_OPTION_ID

For the source code, see this article

MallerComplexity Family tool goes open-source

During RTCNA Boost Your BIM collaborated with Kelly Cone and Matt Mason to create a tool to measure complexity of Revit families. It is named in honor of Aaron Maller who makes some of the most sophisticated families around.

It scores each family and its top-level nested families based on the # of family parameters and # of operators (‘>’, ‘<‘, ‘+’, ‘-‘, ‘*’, ‘/’) in parameter formulas.

Thinking that others might like to continue the development of this tool, Boost Your BIM has created a public repository for the code and looks forward to seeing the enhancements that others might implement.

Git repository:

Discussion at Revit Forum:


No comments:

Post a Comment