Revit API

Revit API

Reply
Active Member
afshin.j
Posts: 6
Registered: ‎08-01-2011
Message 1 of 6 (276 Views)

Shared Parameter change cause exception from a running form

276 Views, 5 Replies
11-17-2011 04:05 PM

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?

Distinguished Contributor
ollikat
Posts: 149
Registered: ‎04-01-2011
Message 2 of 6 (275 Views)

Re: Shared Parameter change cause exception from a running form

11-17-2011 09:59 PM 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::smileyfrustrated:ucceeded when leaving the external command?

Active Member
afshin.j
Posts: 6
Registered: ‎08-01-2011
Message 3 of 6 (268 Views)

Re: Shared Parameter change cause exception from a running form

11-17-2011 10:13 PM 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.!!

Member
Crashnorun
Posts: 3
Registered: ‎10-01-2012
Message 4 of 6 (137 Views)

Re: Shared Parameter change cause exception from a running form

10-01-2012 11:38 AM 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,

 

ADN Support Specialist
mikako.harada
Posts: 52
Registered: ‎08-26-2007
Message 5 of 6 (120 Views)

Re: Shared Parameter change cause exception from a running form

10-05-2012 02:58 PM 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
Autodesk Developer Network

ADN Support Specialist
mikako.harada
Posts: 52
Registered: ‎08-26-2007
Message 6 of 6 (117 Views)

Re: Shared Parameter change cause exception from a running form

10-05-2012 03:03 PM in reply to: mikako.harada

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


Mikako Harada
Developer Technical Services
Autodesk Developer Network

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.