Kfpopeye Open Source, AVF and Other Cleanup

Lots of clean-up operations: open source projects that help clean up a Revit model, certain parameter values and other operations, an important AVF cleanup required to prevent crashing, and some youngsters cleaning up some cash:

Kfpopeye Open Source Projects

Kfpemail-2 kindly announced a bunch of new open Revit add-in projects in the Revit API discussion forum thread on Project Sweeper, ReVVed, and other apps now open source:

A while ago I decided to shut down pkh Lineworks and discontinue work on my apps Project Sweeper, MLTE, ReVVed, Paraline and Knock Knock. I have now decided to make them open source, so anyone can download the code and continue to update them for future versions of Revit.

The repositories can be found in the Kfpopeye repositories on GitHub:

I just added a readme file with a bit more information for them, plus a zip file html_help_files.zip containing the help documentation in html format providing detailed descriptions of what each command does:

Many thanks to pkh Lineworks and Kfpopeye for sharing this work!

AVF Result Clean-Up before Design Option Switch

Zhu Liyi raises a serious issue highlighting the urgent need to clean up AVF results before a design option switch in the Revit API discussion forum thread on how to search all AVF analysis result and remove them, prompting a development ticket REVIT-182024 – SpatialFieldManager within design option duplicated crashes to improve this behaviour in future.

Happily, a simple workaround is perfectly feasible.

Problem Description

SpatialFieldManager within design option duplicated crashes.

The SpatialFieldManager class is an AVF object that exists only in RAM, not in the model database.

It will cause Revit to crash if the result is created inside a design option and that design option is duplicated.

I would like to detect any result that's inside a design option and warn the user, but can't find a way to search for them.

It would be nice to fix the crash bug, or disallow analysis result to be placed inside design option altogether.

I cannot submit a sample model, since the object does not exist in model, only in RAM.

The way to reproduce this is:

Workaround

Alexander @aignatovich @CADBIMDeveloper Ignatovich, aka Александр Игнатович, suggested a fix:

Answer: I have not faced crashes myself, because I haven't used it with design options yet. But I'll try to suggest a workaround:

Response: This is the solution! Thanks.

I did a complete AVF clearing of all views in document.

Here is the code:

  var views = new FilteredElementCollector( doc )
    .WhereElementIsNotElementType()
    .OfClass( typeof( View ) )
    .Cast<View>()
    .ToList();
  foreach( var view in views )
  {
    var sfm = SpatialFieldManager.GetSpatialFieldManager( view );
    if( sfm == null )
      continue;
    else
      sfm.Clear();
  }

Since there is no change to the model itself, no need to open a transaction.

Answer: I haven't tested your code, but I see some potential problems (they could or could not really occur).

The first is View itself, it could be a template, a schedule or other table views, it could be a view sheet or some "internal" views such as project browser. Not sure if GetSpatialManager would throw an exception in these cases now (remember, this behaviour could change in future Revit releases), but I would add a check, something like that:

  ...
  .Cast<View>()
  .Where( x => x.AllowsAnalysisDisplay()

The second thing, are you sure you have to check all views from the model? Maybe it will be enough to check opened views only?

  var views = uidoc
    .GetOpenUIViews()
    .Select( x => doc.GetElement( x.ViewId ) )
    .Cast<View>()
    .Where( x => x.AllowsAnalysisDisplay() )
    .ToList();

Response: Thanks for the check.

Yes; I would have added AllowAnalysisDisplay too, if I had known it exists : P

I tried closing the view, then re-opening it; the AVF object is still there. So, I need to do a document-wide search, not just opened views.

Many thanks to Zhu Liyi for raising this and to Alexander for the good solution!

Young Teen and Kid Sister Crypto Entrepreneurs

A sweet and impressive story about how much is possible nowadays, given appropriate support and motivation:

14- and 9-year-old siblings earn over $30,000 a month mining cryptocurrency

Crypto entrepreneurs