Stuck on choose Function


#1

Hi All,

I’m trying to make a simple AV Screen with a drop down option list for the different sizes (32",42" etc).
I want the choice effect both the overall width and height.
The drop down value is linked to the overall width, so that’s covered.
I’ve linked the OPTION INDEX to the “TVSize”,which is the name of the custom field for the dropdown list.
Then i’ve added =Choose value to the LenZ field with 2 values which relate to the widths of the 2 screen sizes in the dropdown option.
I can’t seem to find the error involved, any help would be great.

Many Thanks in Advance
Adam
test tv.skp (237.6 KB)


#2

Your formula in TVHeight uses a curly/smart quote. (Not smart in this case) :wink:


#3

Cheers Neil,
I’d of never seen that.
I had to delete and replace the quote a number of times til they the same type.


#4

On Mac these smart Quotes can be toggled on /off in MAC-System- Preferences-Keyboard-Text,
you should uncheck when working with formulas
Also ; You’ve set TVHeight to OPTIONINDEX (‘TVSIze’) but the values of the list options off that attribute contains actual lengths in CM, not : 1,2,…N (Integer list options) .
Now, the CHOOSE function in lenZ can’t ‘choose’ so it pops an error


#5

It would be nice if the DC would be smart enough to out smart the smart quotes! :slight_smile: Maybe I should file a feature request? Even though for myself I have outgrown the DC’s and don’t use them anymore.


#6

I also messed up some of the naming, so it got stuck in a loop.
The lengths in cm is the result I was aiming for, so if say 42" size was selected in the options, then it would give a value for the screen width and the choose/choose index would produce the screen height result.
I guess they may be a better way to approach this.
Basically I want to be able to select a screen option from a list and is would effect the width and height of the model.

Cheers
Adam


#7

How did you get it to do that?


#8

This is my end result.
Just need to add a few sizes to the lists and build the rest of the screen parts.test tv v2.skp (234.2 KB)


#9

I can’t see the formula, only the error. Probably you should use CURRENT(“X”) instead of X.
for the TV you should also consider Aspectratio.


#10

I did’t bother to remove the TVHeight formula , instead I used LenZ and LenX to get the Height and Width.


#11

Wierd, this is what I see.


#12

You must set the Values in the list options to Integer numbers, otherwise , CHOOSE can’t ‘choose’

SketchUp functions

How is the CHOOSE-function gonna choose index number 73.8 (the outcome of attribute index) from a list with two options?


#13

So is there an better way to use a dropdown list/value that can give a value for LenZ and LenX?


#14

The user of the DC chooses an option ( in this case 32’’ or 42’’) these are two options , so I would assign the values of those options in the Attribute’s list options dialog.(1 and 2)
You could then easily choose the corresponding Height (in LenZ) and Width (in LenX) with the CHOOSE-function.
for LenZ:
CHOOSE(“option number of User selected choice”, “Heigth if option number=1”,“Height if option number=2”)test tv3.skp (233.1 KB)

Combining the two functions would give:

CHOOSE(OPTIONINDEX(“User’s choice in INTEGER number”), “Length if User chose option 1”, “Length if user chose 2”)


#15

You should consider this:
The User of the DC chooses an option: 32’’ inch or 42’'
but this Size is the diagonal of the screen ( which is dependant of LenX and LenZ) and I don’t want the User to let him choose the LenX and LenZ so I must use the choice of the User (option 1 or 2) in two formulas: one for LenX and one for LenZ
With the optionindex, I can put the corresponding values of the User’s choice in any other Attribute.


#16

That all makes sense, thanks Mike for helping me through this and for all your detailed descriptions.
You’ve taught me something new :slight_smile:


#17

We all gain here something : I for one , am trying to learn how to explain!


#18

Thanks all. I was able to use this discussion to create an adjustable stair that works with our adjustable height staging.

Finally here is the component!

24-40in Adjustable Stairs.skp (2.3 MB)


#19

Thanx for sharing!
Well done!!


#20

Hi:

Thanks, was interesting getting everything to work together.
Would have been nice if instead of an array in the line, we could create a table and have it pull from the table, think Excel.

Thanks,

Kevin Schmidt