Replies: 2 comments
-
|
The model is the Revit document itself, and the Model-ViewModel relationship is our add-in's call to the RevitAPI. The API calls themselves, transactions, collectors, can be in the VM, this is normal, but if the VM grows and contains code responsible not only for Binding to View, it is better to transfer it to separate classes, these are just classes with business logic, but still this will not be a model. The ViewModel should contain only what is related to Binding, View only UI and binding to this VM, the Model section may not be in the plugin at all, because this is a finished Revit document that we don't need to write. For example, here https://github.com/jeremytammik/RevitLookup/blob/dev_winui/RevitLookup/ViewModels/Pages/SnoopViewModel.cs the code that receives elements from the collector is called from the ViewModel, the logic is placed in a separate class to avoid duplication, but at that At the same time, you could easily call the collector directly in the VM. In my plugins, Model is most often missing, and this is normal, we are writing a plugin, not a new product |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have experience in developing Revit ExternalCommand tools. I have just started using Revit API templates while learning to create External Application Addins. So my question is that where does the business logic of Revit API goes into in MVVM architecture? for example, querying the elements and using transactions. Should they go into Model or ViewModel?
Beta Was this translation helpful? Give feedback.
All reactions