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.
Conditional visibility of array parameters
mahir
Member, Developers Posts: 1,304 ✭✭✭✭✭
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?
<div>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); </div><div>annotation { "Name" : "Par2", "UIHint" : "DISPLAY_SHORT" }<br></div><div> arrayVar.par2 is boolean; if (arrayVar.par2) { annotation { "Name" : "Par3" } isLength(arrayVar.par3, LENGTH_BOUNDS); } }</div>
Tagged:
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565You're right, currently there's no way to make it work. You can control visibility of parameters based on other parameters outside the array, but not based on other parameters inside the array.
This feature is somewhere along our horizon of desired improvements. You can file and improvement request to speed it along!
5
Answers
This feature is somewhere along our horizon of desired improvements. You can file and improvement request to speed it along!
https://forum.onshape.com/discussion/7628/conditional-visibility-of-array-parameters/