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.
Selection-Driven Array Parameter?
mahir
Member, Developers Posts: 1,307 ✭✭✭✭✭
I noticed this new parameter type while editing a FS today. How exactly is it used as compared to a standard array parameter? @ilya_baran, @Jake_Rosenfeld? I know queries were already supported by array parameters, so what does the new "Driven query" setting get me?
Standard Array Parameter:
New Selection-Driven Array Parameter:
Standard Array Parameter:
annotation { "Name" : "Widgets", "Item name" : "Widget", "Item label template" : "#myParameter" } definition.myWidgets is array; for (var widget in definition.myWidgets) { // Nested parameters defined here, as e.g. widget.myParameter }<br>
New Selection-Driven Array Parameter:
annotation { "Name" : "Widgets", "Item name" : "Widget", "Driven query" : "entities", "Item label template" : "#entities" } definition.myWidgets is array; for (var widget in definition.myWidgets) { annotation { "Name" : "Entities", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 } widget.entities is Query; // More nested parameters defined here, as e.g. myWidgets.myParameter }
Tagged:
2
Best Answers
-
ilya_baran Onshape Employees, Developers, HDM Posts: 1,210@kevin_o_toole_1 is the real mastermind here. The basic idea is that you manually add items for "normal" array parameters. But for selection-driven array parameters, the whole array parameter acts like a query parameter, and selecting multiple things automatically adds items. This is used for example, for loft profiles, where we want a query parameter for each profile, but by default, we want a separate array parameter item for each selection. You can for instance, copy our loft feature, remove the annotation, and see how the UI becomes less usable for basic lofts.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc2
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565Try out the fill feature and the loft feature to get an idea of what the experience is like.
A selection-driven array parameter is designed to feel like a single query parameter, but with options for each selection. It can be focused in blue like a query parameter. While focused, making selections creates new items in the array, one item for each selection, and the "driven query" in that item is populated with the selection. When a selection is removed, the item is also removed.
In the fill feature, the driven query is hidden, since the only interaction needed is through the main array parameter. In the loft feature, the driven query is exposed, to allow the creation of loft profiles with multiple entities.
2 -
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646Hi @mahir
I think the "Arrays" section on this page (second to last bullet point starting with "Driven Query") does a better job explaining this than I could:
https://cad.onshape.com/FsDoc/uispec.html
Basically using a driven parameter means that new lines will be added to the parameter by making additional selections, rather than by pressing the "Add" button. The "profiles" selection in Loft is an example of a driven array parameter.
Once you've read through that please let us know if you have additional questions.
Jake Rosenfeld - Modeling Team2
Answers
A selection-driven array parameter is designed to feel like a single query parameter, but with options for each selection. It can be focused in blue like a query parameter. While focused, making selections creates new items in the array, one item for each selection, and the "driven query" in that item is populated with the selection. When a selection is removed, the item is also removed.
In the fill feature, the driven query is hidden, since the only interaction needed is through the main array parameter. In the loft feature, the driven query is exposed, to allow the creation of loft profiles with multiple entities.
I think the "Arrays" section on this page (second to last bullet point starting with "Driven Query") does a better job explaining this than I could:
https://cad.onshape.com/FsDoc/uispec.html
Basically using a driven parameter means that new lines will be added to the parameter by making additional selections, rather than by pressing the "Add" button. The "profiles" selection in Loft is an example of a driven array parameter.
Once you've read through that please let us know if you have additional questions.
Thanks, guys. I get it now.
HWM-Water Ltd