YesNo parameter default value?

YesNo parameter default value?

Anonymous
Not applicable
1,566 Views
2 Replies
Message 1 of 3

YesNo parameter default value?

Anonymous
Not applicable

Hello,

 

I can't find in the documentation what the default value is for external shared parameters of type Autodesk::Revit::DB::ParameterType::YesNo.  I had beein thinking of using an invisible parametr to identify objects created by my plugin.  I was hoping the default was no/0 (so that only objects created by my plugin would answer "yes"), but from my testing, it appears that unset values default to yes/1.  Since yes/1 seems to be an odd default (in languages that automatically set memory, 0 is more common than 1), I thought I'd ask for confirmation here that that is the defined behaviour, or if unset parameters can be initialized with random garbage?  I tried searching the API documentation, but haven't managed to find anything yet.

 

Thanks!

Andrea

0 Likes
Accepted solutions (1)
1,567 Views
2 Replies
Replies (2)
Message 2 of 3

Aaron.Lu
Autodesk
Autodesk
Accepted solution
I see different behavior, it looks like it is “Yes" because it is checked, however, the control is gray, and when you call AsInteger, you will get 0. which means it is actually "No".
btw, you can use parameter.HasValue to check if it is updated once.


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 3 of 3

Anonymous
Not applicable

Ah, yes, I didn't notice that it was grey, just that it was checked, and the hover value matched the checked value.  I hadn't tried reading it in code, since I assumed it would match what was showing.  

 

I had noticed that HasValue call before, I'm not sure why it didn't click to use it here... that's exactly what I needed.  Thanks!  😄

0 Likes