"Remembering" command options

Hey there,

I was wondering how one can “remember” certain command options when a user runs a command. In my current program, the values are always reset to some hardcoded default options.

Does anyone know how to change this?

Thank you,

Jeroen

Hi @jeroenvanlith,

Normally this is done by maintaining member variables on your command class(es).

– Dale

Hi Dale,

An answer within 3min - great! I will have a look into member variables :).

Thank you,

Jeroen

Interestingly I have no code for sticky options but about half my r5 plugins that “compatabilty” load in R6 now have sticky command line options. Is that new functionality built into the get routines in R6?

I don’t believe we did anything “magical” here. I’m not sure why you are seeing anything different.

ill grab a video today of them running in r5 (each restart of command has the defaults set by get command, but in r6 restarting the command the options are at what they were when I last left the command. strange glitch, but not unwelcome,

too lazy (and busy) for video, but added these two lines at command exit and now it works without remembering command line options in R6. has not changed how command runs in R5. Probably just the way I do my gets leaving them hangin in memory… :wink:

I had to do the same thing originally to stop the last brep in points conduit showing up in my screen when i restart the command.

Capture2

Hi there, I figured that using settings in c# (https://msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx) works for remembering command line options, and it seems to work quite well. Are there any things I have to look out for? Thank you.

Hi @jeroenvanlith,

Here is the Rhino way:

https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsCommands/SampleCsPersistentSettings.cs

– Dale

Hi @dale, great, many thanks!