DC SET function not only with onClick?

DC SET function not only with onClick?

Postby halroach » Fri May 06, 2016 3:53 pm

Hi,

One of the dynamic component onClick functions is called SET, where one can, with a click, change the value of another attribute.

1. 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))

2. 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...
0
User avatar
halroach 
 

Re: DC SET function not only with onClick?

Postby pcmoor » Sat May 14, 2016 10:29 am

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
0

pcmoor 
 

Re: DC SET function not only with onClick?

Postby halroach » Sat May 14, 2016 10:56 am

pcmoor wrote: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


I 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-r ... ions/20177

I'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!
0
User avatar
halroach 
 

Re: DC SET function not only with onClick?

Postby halroach » Fri May 20, 2016 4:13 pm

pcmoor wrote: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


I'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 another formula 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
0
User avatar
halroach 
 

Re: DC SET function not only with onClick?

Postby pcmoor » Sat May 21, 2016 12:11 pm

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
0

pcmoor 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Dynamic Components

Who is online

Users browsing this forum: Ch4F and 2 guests

Visit our sponsors: