Document.EditFamily slow performance

Document.EditFamily slow performance

Anonymous
Not applicable
460 Views
2 Replies
Message 1 of 3

Document.EditFamily slow performance

Anonymous
Not applicable

Hello, I have a strange experience: when using the Document.EditFamily method, it performs very slowly when invoked from a WPF dialog. In contrast to it, when using the same method in the RevitLookup API sample (which uses Windows Forms), that method executes in a snap. Beyond that, I also experience that the Revit GUI is flashing (performs some screen updates when calling the method), which do not happen in RevitLookup. Can someone explain what could happen in the background?

The reason why I use this method because I have to access some information stored in the Family (actually I use ElectricalConnectors, which contain the Connector Description parameter, I have to access that value).

Does anybody know any alternate way to access the content of the Family other than the EditFamily method? (Read-only access is enough).

0 Likes
461 Views
2 Replies
Replies (2)
Message 2 of 3

Joe.Ye
Alumni
Alumni

 

I didn't have the experience of calling EditFamily from the WPF dialog is slower than ordinary form. 

 

With regard to getting the parameter value from connectors, you can get the parameter value directly from the corresponding FamilyInstance's connector. This can avoid opening the family document. And the performance should be high.

 

Connectors of a family instance can be reached following this process.

FamilyInstance.-> MEPModel ->ConnectorManager -> Connectors -> target connector.

 

Each Connector has a list of properties. You can get the parameter value from these properties.

 

Hope this helps.



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 3 of 3

Anonymous
Not applicable

Hello Joe,

Thank you for the quick reply. I didn't mention in my previous post that I need to access the Connector Description parameter, which is a Parameter of the ElectricalConnector located in the Family. So it is not accessible directly from the Connector in the FamilyInstance (because there is no mapping in the API between the Connector and the ConnectorElement it is originating from).

For us it could have been very helpful if we were able to access the ConnectorElement (ElectricalConnector) directly from the Connector.

Now I created a workaround, which collects the necessary information (Origin/Location and Connector Description) by using an EditFamily call, then putting that information into ExtensibleStorage Entity objects (thus the EditFamily call is necessary only when the original Family is updated), but this is a bit error-prone (since if the user forgets to call my updater method, the values stored in the ExtensibleStorage and the real situation will differ).

What could also be helpful that some additional Events would have been introduced (for example, when loading a Family into a Project). I know that this is not the forum where such wishes should be put, but I would like to ask for a location where I can submit them.

0 Likes