Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Featurescript to select the variable
papawo
Posts: 206 PRO
Is it possible to use featurescript to select the #variable array?
I have a #Variable array that I would like to select using UI booleans.
I have a #Variable array that I would like to select using UI booleans.
Tagged:
0
Comments
-
I'm not quite clear on what you're asking for. What do you mean by "a #variable array"? What's the goal of this feature? Does an Array parameter give the UI you're looking for?
0 -

this is my #variable
when I put 3 in the #Option , it will choose 60in for the #Width
Now what Im trying to do is create a custom feature that has a boolean selection of width.
and when I select a 20in width from the boolean , it will trigger #Option1
I want to do a featurescript that will make use of setting variable I already have.0 -
Okay, I think I see now.
It looks like you have three choices:- Create a length parameter allowing any value. If the user wants a specific value in their list, they can set that value to something referring to the Part Studio variables. e.g. "[20 in, 30 in, 60 in, 80 in][#Option]" or "#Width".
- Create an enum parameter with hard-coded values, (e.g. "20 in", "40 in"....). If you need a different set of values, you need a different feature (or some conditional visibility to switch between multiple dropdowns)
- Create an enum parameter with "Option 1", "Option 2", etc. and, inside the feature, use getVariable to extract the "Width" variable and extract the relevant item in the array.
Let me know if you have more questions!0

