algorithmic modeling for Rhino
Hello all,
For debugging purposes, I'm trying to assign default values for input parameters in a component I'm writing. The parameters are generic and I didn't find a way to do so.
I'm adding the code itself(SolveStructure) and a code for the structures construction(Vectors)
Thank you
Tags:
Hi Roey, you can write something like this:
pManager.AddGenericParameter("", "", "", GH_ParamAccess..., YOUR DEFAULT VALUE)
that's what I usually do.
in this case, the generic parameters are structures of 8 fields. how do I assign values for each field using what you wrote?
Hi Roey,
your data types do not derive from IGH_Goo, so you cannot put them in parameters. You have to wrap them up first inside GH_ObjectWrapper, or if you want to do it properly you can provide specific GH_Goo derived types for them.
May I also suggest you make all your structs immutable (if you want mutable data, uses classes instead of structs), and do not use abbreviations for variables and fields. You may remember today what it all means, but when you come back to this code one year from now, it'll be hard to figure out what e, a, i, l, no, val, and loc actually mean.
See attached file. It properly encapsulates private member fields, it makes all structs immutable, and it assign default values to the input parameters inside RegisterInputParams.
Thanks for the quick help.
and also for the enlightening remarks:)))
I have another question now.
If I want to access the parameters of "member" i get an error that this is readonly and I can't change it. for example, in the code you uploaded, try to assign "c" to member.L
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by