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.

Selection-Driven Array Parameter?

mahirmahir Member, Developers Posts: 1,291 ✭✭✭✭✭
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:
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
}

Best Answers

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    Answer ✓
    @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 Inc
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited May 2018 Answer ✓
    Try 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.
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    edited May 2018 Answer ✓
    Hi @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 Team

Answers

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    Answer ✓
    @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 Inc
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited May 2018 Answer ✓
    Try 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.
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    edited May 2018 Answer ✓
    Hi @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 Team
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    We make a loverly chorus, the three of us :tongue: 
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    @kevin_o_toole_1, @Jake_Rosenfeld Great timing, guys :smile:
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • mahirmahir Member, Developers Posts: 1,291 ✭✭✭✭✭
    We make a loverly chorus, the three of us :tongue: 
    All together now!  :D

    Thanks, guys. I get it now.
  • mahirmahir Member, Developers Posts: 1,291 ✭✭✭✭✭
    Is there an Onshape barbershop quartet? @NeilCooke can be the 4th.
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    If it's singing you want them you'll need a Welshman. @philip_thomas, where are you at boyo? 🗣️
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    @owen_sparks - Sorry, I am awesome at many thing, alas singing is NOT one of them :)
    Philip Thomas - Onshape
Sign In or Register to comment.