Advertisement

Saturday, December 3, 2016

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

Updated on December 4, 2016: changed sort order to descending.

From the Boost Your BIM website:

#RTCEUR Wish 1 granted!

Chris asked how the API could help copy a legend to multiple sheets. Wish granted!



For the source code, see this article

#RTCEUR Wish #2 Granted! Rename views

Jason asked “How about a find / replace tool for view names?”

Wish granted!



For the source code, see this article

#RTCEUR Wish 3 granted (part 1)! Multiple Element Revision Creation

Barrie asked: “Can you rev cloud all change elements in views on sheets and write update to rev cloud comments for tagging?”

This post shows how to prompt the user to select multiple elements then create a new revisions and a revision cloud around each element. A following post will discuss to what extent this could be automated to create revisions every time the model changes.



For the source code, see this article

#RTCEUR Wish 3 continued & discussed – automatic revision clouds

In the previous post I showed how the API can create a revision and cloud for elements selected by the user. Now, what if you wanted the revisioning to be done automatically every time the user makes a change, addition, or deletion?



It works nicely when the table is moved or a new, wall is created that does not join with other walls.

But what happens when a window is moved or a wall that joins to other walls is created? Too many elements are included in the revision cloud – not good! This is because when the user modifies an element hosted by the wall, Revit makes changes to both the hosted element (such as the door) and also the wall that hosts the door. The same issue comes up when a new wall joins with existing walls – they all are changed. GetModifiedElementIds does not let us differentiate between the element that the user changed and the elements that Revit changed because of the user change.

It might be possible to get the selected element using the Idling event, store its element id, and then in the updater only create the revision cloud around this element if it was modified.

Automatically creating a revision cloud around an element’s former location after it has been deleted is even harder. GetDeletedElementIds gives the ids of the deleted elements, but because they are deleted they no longer have a bounding box or location that you can get to define the curves of the revision cloud. To do this you would need to store the id and bounding box coordinates of every element in the model, and then retrieve that data after the element is deleted. If smoke starts coming out of your computer from doing this, don’t say I didn’t warn you.

For the source code, see this article

#RTCEUR Wish 4 granted! Change parameter value in multiple families

Doug asked ” How about a routine to change the value of a shared parameter in all families in a folder to the same specified value.”

For the source code, see this article

#RTCEUR Wish 5! View Template (partially) exported

T.R. wished for the ability to “compare two view templates to identify/highlight differences. Or a way to spit them to txt/xls for compare”

We can get the data from all parameters stored as numbers, text, and element ids. We can also query the properties of the View class. In the sample code, this is done using reflection so code does not need to be written for each property individually.

Also, GetNonControlledTemplateParameterIds returns a list of parameters that are not marked as included when this view is used as a template. GetTemplateParameterIds returns a list of parameter ids that may be controlled when this view is assigned as a template.

For the source code, see this article

Related

No comments:

Post a Comment