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.
UI Hint "REMEMBER_PREVIOUS_SELECTION" (FeatureScript)
darren_13
Member, Developers Posts: 119 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
Cheers,
Darren
Tagged:
1
Comments
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.
Thank you very much for your help,
Darren