Hi all
I was building an app and used Form.Show() instead of Form.ShowDialog(), because I thought I could use the form in modeless functionality to be able select elements while keeping the form open.
Then I forgot to add a Transaction to the part which modifies the model. The modification consists of reading an excel file and modifing parameter values of selected elements.
Then I discovered that it was possible for me to write data to the parameters I wanted even though i didn't use a transaction. Also the undo list stays empty and does not record my modifications. The change in parameter data is only visible after I deselect/select element.
Is this an issue or is it as intended? More info on request.
Dear Mgo,
Thank you for your query.
Wow.
No, this is definitely not intended, and I would not recommend continuing to do this.
Changes are high that this will corrupt the model one way or another.
Could you possibly package this as a minimal reproducible case for the development team to look into further?
https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b
Thank you!
Best regards,
Jeremy
Hi Jeremy
I am glad to help, I will create a reproducible case when I get the time -- maybe next weekend.
Untill then....
OK, thank you, looking forward to seeing it!
I wish you a good week.
Hi
Attached is a minimal add-in showing how to change a value of a parameter outside a transaction.
The addin command is run through the add-in manager. It is on Revit 2019.2.
Dear Mgo,
Thank you for your reproducible case and for reporting this.
I logged the issue REVIT-146176 [Able to modify parameter with no transaction -- 15219383] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.
I would strongly suggest that you continue to open a transaction for every document modification in spite of this weird behaviour 🙂
Thank you!
Best regards,
Jeremy
Dear Mgo,
Thank you for your patience.
The development team analysed the issue REVIT-146176 [Able to modify parameter with no transaction -- 15219383] that you reported and say:
Indeed, it looks like none of the API-exposed Parameter.Set() methods verify isDocumentModifiable() before changing data...
It should still check!
Update: At least in 2020, my efforts to run a macro which doesn't use the form dialog don't work. We do get an exception in that case. I'm not sure if the dialog is necessary or not.
Note this is a 2019 bug and possibly it's a 2019-specific problem.
I tried actually using the customer's addin in the addin manager, and I also can't reproduce the problem (with walls and Revit 2020).
It may be that the problem is specific to 2019 or it may be that the problem can't be reproduced with wall elements. In my current test, the element doesn't change and I also don't get any errors.
So, it seems that the situation has already improved and stabilised a little bit in Revit 2020, even before your report...
Best regards,
Jeremy
You have to deselect and select the element in question to see the change in the parameter -- there's no Regenerate...
Can you try to reproduce in Revit 2020 as well? The development team say, 'I see where he says about deselecting and reselecting but I've tried that (in 2020) without it working. We're having someone test it in 2019 but we don't know yet whether it's "fixed in 2020" or "We're not doing the right thing to reproduce it".'
Thank you!
Dear Mgo,
Thank you for your patience.
The development team were able to reproduce the issue now, including in Revit 2020.
The analysis issue REVIT-146176 [Able to modify parameter with no transaction -- 15219383] was therefore closed as Code Fix Needed, and a new development issue REVIT-146926 [Able to modify parameter with no transaction -- 15219383] was opened to actually perform the fix in a future version. Please make a note of this number for future reference.
Thank you!
Best regards,
Jeremy
Dear Mgo,
Thank you for closing the associated internal developer support ticket 15219383 [A way to modify model outside transaction, issue?].
The development team are aware of the issue now and will handle it from here on.
Best regards and all the best moving into the next decennium!
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.