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.

UI Hint "REMEMBER_PREVIOUS_SELECTION" (FeatureScript)

darren_13darren_13 Member, Developers Posts: 117 PRO
I have a feature script that for many instances require me to select the same things (A plane, a few points and a solid) it would be good if I could get it to save the previous selection.

Cheers,
Darren
Tagged:

Comments

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 454
    I don't know your precise use case, but if you have a situation where you have multiple features needing to reference the same entities, perhaps a good workflow would be to have a setup "Start" feature which flags the necessary entities by setting context variables or entity attributes, and then successive features reference those entities.

    Alternatively, you can do it without making another feature by using editing logic: Remember the values of the previous feature in with context variables or attributes, then, using editing logic on feature creation, set the parameter value to the query you find, if any.



    To clarify a bit on why the obvious thing doesn't do the job: REMEMBER_PREVIOUS_VALUE works for almost all parameter types, but not Queries. That remembered value is associated the user (not the tab or the document), so when you're working in another Part Studio tomorrow, that previous value will still be remembered. This usually doesn't make sense for selections, which tend to have transient scope (they're nonsensical outside the single Part Studio, and even within the Part Studio they may not exist earlier or later in feature history). The workaround above gets around this by confining the scope to the current Part Studio, and performing an evaluation in the editing logic function to check if queried entity still exists.

  • darren_13darren_13 Member, Developers Posts: 117 PRO
    @kevin_o_toole_1, the editing logic sound very much like what I need. I'll have a play with this and let you know how it goes. 

    Thank you very much for your help,
    Darren
Sign In or Register to comment.