I am trying to change an instance shared parameter value from a .net win form which has been shown by running an external command.
after changing the value of parameter of an element, the new value will be shown in the property panel, but when saving the model, the property has been restored to the previous value.
I tried Transaction but get following error:
Autodesk.Revit.Exceptions.InternalException was unhandled
Message=An unexpected managed exception was thrown by internal Revit code.
Source=RevitAPI
StackTrace:
at Autodesk.Revit.DB.Transaction.Commit()
...
Any Idea?
This a little bit silly thing to ask, but still...are you sure, that you have started the transaction before parameter change & commit?
Other thing about losing the changed value. Are you sure that you return Result::Succeeded when leaving the external command?
Yes, Pretty Sure,
and the funny thing is, if I don't use transaction, the value will be changed but won't be saved by saving the model.!!
I"m having a similar problem with the adaptive generic component. Has there been a solution or reason as to why / what that error mean?
Thanks,
Hi Crashnorun,
If you are asking about the meaning of this message:
>>>
Autodesk.Revit.Exceptions.InternalException was unhandled
Message=An unexpected managed exception was thrown by internal Revit code.
<<<
This is a general message when an error thrown by somewhere in the code weren't caught by the program.
Try including Try/Catch statement, and try to catch an error. If yo look at SDK samples, you will see many examples which shows you how to use Try/Catch.
If you are still having a problem, I advice you to post a separate question with a ready-to-build, minimum, reproduciable sample project to demonstrates your issue.
I just saw you have already posted. Thank you very much.