• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Revit API

    Reply
    Active Member
    afshin.j
    Posts: 6
    Registered: ‎08-01-2011

    Shared Parameter change cause exception from a running form

    257 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?

    Please use plain text.
    Distinguished Contributor
    ollikat
    Posts: 104
    Registered: ‎04-01-2011

    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?

    Please use plain text.
    Active Member
    afshin.j
    Posts: 6
    Registered: ‎08-01-2011

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

    Please use plain text.
    Member
    Posts: 3
    Registered: ‎10-01-2012

    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,

     

    Please use plain text.
    ADN Support Specialist
    Posts: 25
    Registered: ‎08-26-2007

    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

    Please use plain text.
    ADN Support Specialist
    Posts: 25
    Registered: ‎08-26-2007

    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

    Please use plain text.