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.

Options

How can I get a list of variables set in a context?

arthur_petersarthur_peters Member Posts: 19
I would like to create a feature that can import all variables in one Part Studio into another one. I can relatively easily import variables as long as the calling feature knows their names, however I do not see a way to get a list of variables from a context. Is what I want possible? Is there a specific reason not to allow it? (I think it should be possible, even if you only want to expose "normal" variables of some kind, given that variable table exists.)
- Arthur (he/him)

Best Answer

Answers

  • Options
    MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,036 EDU
    Answer ✓
    @arthur_peters

    Try the function getAllVariables(context is Context) from context.fs
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Options
    arthur_petersarthur_peters Member Posts: 19
    Thanks!!! I failed to check that source file. I did check others, but for some reason not that one. This is perfect. (And I accept it's internal and may change in incompatible ways without warning.)
    - Arthur (he/him)
  • Options
    matthew_mueller537matthew_mueller537 Member Posts: 24 PRO
    If you're looking for a pre-built solution, this custom feature made by a FIRST Robotics team is great for transferring variable libraries between part studios.
Sign In or Register to comment.