Deleting Storage and Picking a Symbol

Today, I share two interesting hints from the forum and some thoughts on feedback, community and communication:

Before we get into these, we have an open position in the Revit development team: Scott Conover, director of engineering at Autodesk says on LinkedIn:

We're hiring! I strongly believe that the tools we will be building on this team are critical to the future of building design – and improving the state of the planet in the future. Let me know if you know someone who might have an interest... Senior Product Owner, Building and Energy

Unload IFC Links to Delete Extensible Storage

Several developers reported problems deleting extensible storage.

A new contribution to the Revit API discussion forum thread not able to delete extensible storage schema reports that unloading IFC links may help:

I created a very small example Example_RemoveSchemas.zip with an IFC link with a few walls created in Revit 2020. The file contains 4 macros:

In Revit, 2020 I am not able to remove any schemata when the IFC link is loaded.

Many thanks to Marek @Songohu_85 for testing and reporting this.

I wonder whether it will help others resolve similar issues.

To illustrate this post, I asked artbreeder to create some images with the description unload ifc link to delete extensible storage:

Unload IFC link to delete extensible storage

Unload IFC link to delete extensible storage

Unload IFC link to delete extensible storage

Unload IFC link to delete extensible storage

Unload IFC link to delete extensible storage

Picking, Selection and UI Design

Richard RPThomas108 Thomas shares some advice on Revit add-in UI design and selection in general in his answer on how to pick FamilySymbol from project browser:

Question: I want my user to select a FamilySymbol that's already loaded from the UI (more specifically, the Project Browser) that I then further process in my own code. I'm aware that there are different methods for filtering the already existing custom families/loading families from file and so on, but is there a way to prompt the user to pick one from the project browser? Ideally, it would NOT require the user to make conscious decisions on where to click before starting the add-in.

Answer: You could ask users to select an element instance from their view, then get the FamilySymbol from that, but I don't think it's possible from the browser.

It's not the usual workflow, but now, in Revit 2023, you have the selection changed event which also applies to project browser. This code prompts user to select from browser before adding a selection changed event:

Public Function Obj_220831a(
  commandData As ExternalCommandData,
  ByRef message As String,
  elements As ElementSet) As Result

  Dim IntUIApp As UIApplication = commandData.Application
  Dim IntUIDoc As UIDocument = commandData.Application.ActiveUIDocument
  Dim IntDoc As Document = IntUIDoc.Document

  TaskDialog.Show("Select""Pick family symbol from project browser")
  AddHandler IntUIApp.SelectionChanged, AddressOf SelectionChanged

  Return Result.Succeeded
End Function

Public Sub SelectionChanged(
  s As Object,
  e As Autodesk.Revit.UI.Events.SelectionChangedEventArgs)

  Dim UIapp As UIApplication = s
  Dim J As ISet(Of ElementId) = e.GetSelectedElements
  Dim J0 As List(Of ElementId) = J.ToList

  Dim FEC As New FilteredElementCollector(UIapp.ActiveUIDocument.Document, J0)
  Dim F0 As New ElementClassFilter(GetType(FamilySymbol))
  Dim Els As List(Of Element) = FEC.WherePasses(F0).ToElements

  If Els.Count > 0 Then
    TaskDialog.Show("Selection", Els(0).Name)
    RemoveHandler UIapp.SelectionChanged, AddressOf SelectionChanged
  End If
End Sub

The handler filters for the class of FamilySymbol* and shows a dialogue if the result yields more than 0 results.

Note that not everything in the project browser is a FamilySymbol; the parent ElementType class will cover more aspects such as system families.

You would have to continue execution in the handler and perhaps raise an external event to get an editable document status (I suspect the selection changed event doesn't give you that).

You can also use e.GetDocument instead of casting the sender s to UIApplication to get the Document.

Response: Thanks for your reply. In your opinion, what would be a workflow that is more common?

Answer: It really depends on what your add-in is being used for, i.e., is it modal or modeless interaction? Is it working with a few categories of elements or many?

It is often the case you have to create dialogues that replicate the ones Revit inherently has which is a bit annoying but doesn't take that long with WPF for something such as FamilySymbol selection. That would allow a modal interaction.

You aim to stay within the IExternalCommand context in a modal way to start with, but if that isn't possible, then you have to get back into a similar context via raising an ExternalEvent from modeless forms etc. There are also other methods of obtaining a valid context to work with.

Response: Thanks for the answer!

Do you happen to have any pointers or examples of how to develop modeless forms with the Revit API by chance? Would be much appreciated, thanks!

Answer: There are samples in the SDK:

It is for Windows Forms, but same approach would be used for WPF.

Many thanks to Richard for the important fundamental advice.

Feedback is Always a Great Gift

Jim Quanci, our senior director of developer advocacy, pointed out a nice article encouraging feedback:

Thought some of you might find the below piece on 'feedback' interesting. I actually believe most of our team is pretty good at accepting feedback... but I know I can at times 'not fully embrace feedback enough'. This article is a nice reminder. To some degree, it's about receiving feedback with humility. :-)

Axios CEO Jim VandeHei shares his weekly learnings on life and leadership:

1 big thing: How to take feedback

In the summer of 2004, hours before John Kerry's nomination speech at the Democratic convention, Washington Post political editor Maralee Schwartz gut-punched me with some brutal feedback.

Why it matters: "Feedback is a gift," the management gurus say. But in my experience running two companies, it's a gift most don't truly want.

But learning to accept the gift with wisdom and humility is a superpower we all need. It's the gateway to growth.

Here's my blunt feedback about taking blunt feedback:

Case in point: Often when you're giving a face-to-face review, people will validate and vindicate areas of weakness in the written eval.

The bottom line: Life is about forward motion. Elicit and take feedback to make your personal and professional performance tomorrow better than today.

Scott Peck and Community Building

The topic of accepting and appreciating feedback reminded me of my own recent exploration of community building in a book and a weekend workshop.

In case anyone is interested in going one step further in the direction of active listening and personally enhancing all their human communication and interaction, I can highly recommend the book by Scott Peck on community building: The Different Drum: Community Making and Peace.

It is one of the best books I have ever read. One main focus is on really truly listening.

After we both read the book, my partner and I participated in a weekend workshop to practice community building with 26 people we didn't know, supported by 5 facilitators. The facilitators mainly just pointed out some basic communication recommendations, such as:

Highly recommended practices for all human interaction, especially in teams, relationships, families, politics, enterprises, projects.

Our workshop was organised by Andreas in Biel and led by Edward Groody of CBI, Community Building International.