DC SET function not only with onClick?
-
Hi,
One of the dynamic component onClick functions is called SET, where one can, with a click, change the value of another attribute.
-
Is there an equivalent to the SET function, that would change the value of another attribute, but not necessarily with a click?
Something like this:
IF(something=1,SET("someOtherAttribute",17)) -
On the same note, would there be a way to set the contents of an attribute to be a formula, rather than just a value (in this case with an onClick... or some other way...):
onClick => SET("something",=otherValue)
That way:
something => =otherValue
So if let's say 'otherValue' = 7 so, 'something' will also equal 7 eventually... -
-
You can place formulas within the options values, this can be used as a trigger to set attributes
Plus it makes the attribute dialog cleaner and not so cluttered
-
@pcmoor said:
You can place formulas within the options values, this can be used as a trigger to set attributes
Plus it makes the attribute dialog cleaner and not so clutteredI didn't think of that. That could be quite helpful!
I was thinking, that if one could set an attribute with another attribute, it could serve as a type of workaround to the issue of values/formulas being zeroed out when editing multiple DC's. So you could just reset the formula with a click or option.
Like maybe there would be an additional solution to the one's you've pointed out here:
http://forums.sketchup.com/t/formulas-replaced-with-values-when-changing-multiple-dynamic-component-options/20177I'm sure there could be many other use cases for this...
BTW. I've been following your various posts about DC's lately... So very insightful and helpful!
Thanks!
-
@pcmoor said:
You can place formulas within the options values, this can be used as a trigger to set attributes
Plus it makes the attribute dialog cleaner and not so clutteredI'm trying to place different formulas within the options values, but I'm having trouble with it. I want the user to choose an option. A formula will be output, and I want to be able to output anotherformula that corresponds to the user's choice.
I took the same file you uploaded, and added +5 to the first formula. When I try to check the index with "OPTIONINDEX", I get -1 instead of 1. Have you encountered this?
Why am I getting -1!? If I remove the +5... it works fine. This happens with other variations of formulas where I add a + sign...File attached
-
I believe in coding -1 is returned when a match is not made
the use of + seems to create a bug in the ruby side to DCs
- minus works, so a work around is to use a variable, being positive at first, then changing it to negative after the ruby script behind the scenes has accept it
=2*current("leny")*2.54-val
where the attribute val initially = 5, then change it to -5 after the first run
this is probably only required if you were relying on the index for your calculations
Advertisement