[Bug] document.LoadFamily() breaks UI update

[Bug] document.LoadFamily() breaks UI update

nice3point
Advocate Advocate
906 Views
8 Replies
Message 1 of 9

[Bug] document.LoadFamily() breaks UI update

nice3point
Advocate
Advocate

When using the document.LoadFamily() method, there is a problem that freezes the UI update of both my plugin and the entire Revit ribbon. The problem occurs when my plugin has a Storyboard animation and when the family is updated during LoadFamily (for example, from version 2019 to 2023).

 

Tested Revit versions: 2021-2023

 

Before loading:

nice3point_2-1658323777150.png

 

Updating:

 

nice3point_0-1658323737671.png

 

After loading:

nice3point_1-1658323765193.png

 

The revit ribbon is not responding, neither is my plugin. Temporary treatment by right-clicking anywhere or left-clicking on the properties panel.

 

Solution and family in attached files.

0 Likes
907 Views
8 Replies
Replies (8)
Message 2 of 9

a.slutskij
Participant
Participant

I had the same problem in Revit 2022, but for now only on default Sample Architecture Project

0 Likes
Message 3 of 9

ricaun
Advisor
Advisor

I was not able to compile your solution in Visual Studio 2022, something with 'Duplicate AttributeUsage' related to the 'Microsoft.Toolkit.Mvvm.SourceGenerators.NullabilityAttributesGenerator'.

 

I create an example from scratch and looks like works fine.


After that, I add the 'ProgressRing' code on the WPF and something happens after loading the family, the UI break and stops updating or something.

 

Here is a quick video.

 

https://youtu.be/ZnaGXmanCrI

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 4 of 9

nice3point
Advocate
Advocate

@ricaunthanks for the video) https://github.com/dotnet/wpf/issues/6792#issuecomment-1183530305  this is a bug in the latest version of .Net 6, Microsoft hasn't fixed it yet, a workaround is to downgrade the Sdk version in global.json https://github.com/Nice3point/RevitTemplates/discussions/25 

 
 

 

 

0 Likes
Message 5 of 9

ilya.sector.1
Participant
Participant

I had the same problem, UI breaks when there is animation during family update

0 Likes
Message 6 of 9

ricaun
Advisor
Advisor

Looks like is something related to the Storyboard and Animation in the WPF.

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 7 of 9

Kennan.Chen
Advocate
Advocate

Loading a rfa file into a document using LoadFamily() freezes Revit UI - Autodesk Community - Revit ...

 

I ran into this problem years ago and you can refer to the above thread to get a workaround

Message 8 of 9

nice3point
Advocate
Advocate

The first time Balloon worked, all the others had no effect. It's a shame that for so many years the problem has not been raised or solved by Autodesk

0 Likes
Message 9 of 9

Kennan.Chen
Advocate
Advocate
It functions well to host the UI in a standalone WPF app that communicates with Revit process via IPC.
I use this workaround in production for years.
0 Likes