Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Shared Parameter change cause exception from a running form

5 REPLIES 5
Reply
Message 1 of 6
afshin.j
487 Views, 5 Replies

Shared Parameter change cause exception from a running form

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?

5 REPLIES 5
Message 2 of 6
ollikat
in reply to: afshin.j

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?

Message 3 of 6
afshin.j
in reply to: ollikat

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.!!

Message 4 of 6
Crashnorun
in reply to: afshin.j

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,

 

Message 5 of 6
mikako_harada
in reply to: afshin.j

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.  


Mikako Harada
Developer Technical Services
Message 6 of 6

I just saw you have already posted. Thank you very much.


Mikako Harada
Developer Technical Services

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community