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.

Conditional visibility of array parameters

mahirmahir Member, Developers Posts: 862 ✭✭✭✭
edited November 2017 in FeatureScript
Is it possible to have a parameter array whos individual sub-parameters can be driven by array-level logic? I don't know why, but the below precondition code does not work. I get tagged with an error on the boolean condition of the if statement. It looks like I can't reference individual "arrayVar" parameters. Is there a way to make it work? 

annotation { "Name" : "Array Variables", "Item name" : "Array Var"}
definition.arrayVars is array;

for (var arrayVar in definition.arrayVariables)
{
   annotation { "Name" : "Par1", "UIHint" : "DISPLAY_SHORT"}
   isLength(arrayVar.par1, LENGTH_BOUNDS);

   annotation { "Name" : "Par2", "UIHint" : "DISPLAY_SHORT" }
arrayVar.par2 is boolean; if (arrayVar.par2) { annotation { "Name" : "Par3" } isLength(arrayVar.par3, LENGTH_BOUNDS); } }

Best Answer

Answers

Sign In or Register to comment.