Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Very simple FS question - dropdown for selecting from multiple variable sets

romeograhamromeograham Member Posts: 635 PRO
edited September 2021 in FeatureScript
I'm sure this is quite simple - but I'm having a hard time figuring it out on my own (extremely new to FeatureScript).

I would like to build on the strategy @Evan_Reese shows for an approach to global variables here to do the following:

I'd like to be able to pick from several standard specifications for a thing in a drop down in the UI. Then, based on the selection, different values would be assigned to my Variables.

If I select "Type 1" from the list, then the variables would be: A=1mm, B=1.5mm etc
If I select "Type 2" from the list, then the variables would be: A=2mm, B=3mm etc

Variables A, B are values from specification tables.

I understand how to create the variables and assign values etc...I imagine that I can easily create different sections in my FS that would have all the variables and their correct values. Something like this:

//Values for Type 1

//Values for Type 2

I don't know how to:
  1. make the dropdown show up in my UI
  2. do the if/then statement that would point Onshape to the correct values for the variables based on which item I pick from the Dropdown.
I know there are many custom FS built on this type of UI interface etc - but many are so complex (and create geometry etc) that I'm having a hard time finding code that I can emulate.



Sign In or Register to comment.