using mvvm & wpf with transaction & doc.regenerate()

using mvvm & wpf with transaction & doc.regenerate()

Anonymous
Not applicable
2,720 Views
2 Replies
Message 1 of 3

using mvvm & wpf with transaction & doc.regenerate()

Anonymous
Not applicable

hi dears

i'm working on simple command
it have wpf form bonded to class as per mvvm methods

i call the wpf from my command and it show up using wpf,show();

i use the form and change data then click the buttom to run command on viewmodel from my form as usual in mvvm to pick the objects and change its data
i can close my form
when selecting the object after that i can see that parameter data has changed as i want but document can't fell that changes and i can't generate the document
my problem is i cant use transaction.start on my mvvm command and ca't regenerate the document to see the changes in the tags
how can i solve that?

many thanks in advance

0 Likes
Accepted solutions (1)
2,721 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk
Accepted solution

It sounds as if your WPF form is not running as a modal form within a valid Revit API context.

 

Consequently, you are trying to access Revit and its API from outside. This is basically not possible. A workaround exists via the use of an external event:

 

http://www.revitapidocs.com/2018/05089477-4612-35b2-81a2-89c4f44370ea.htm

 

This issue was recently discussed in another thread on Revit API with WPF:

 

https://forums.autodesk.com/t5/revit-api-forum/revit-api-with-wpf/m-p/8209618

 

The official approach is presented in the Revit SDK sample ModelessDialog/ModelessForm_ExternalEvent.

 

Many other discussions and solutions are listed by The Building Coder in the topic group on Idling and External Events for Modeless Access and Driving Revit from Outside:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 3

Anonymous
Not applicable

dear Jeremy

many thanks for your continuous support

i will study those links
i fell it will be very helpful

thanks again

 

0 Likes