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.
Is there a getAllVariables()? Specifically Configuration Variables.
leon_poot
Member, Developers Posts: 87 ✭✭✭
Is there a way of accessing a list (map) of all (configuration) variables in a Part Studio?
Perhaps a way of accessing the input of the build(config) function?
Basically a
Perhaps a way of accessing the input of the build(config) function?
Basically a
getAllVariables()is what I'm after, in the spirit of
getAttributes(...qEverything()...)
"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
Tagged:
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565There is currently no such function. The end user can, of course, explicitly set any quantity or isAnything input to #myConfigVariable. This is the preferred, non-magical way of using those values. If you'd like a magical way, please submit an improvement request with your use case
If you're just looking to find a single variable (or any of a small set of known ids) which may or may not be set, note that you can sayconst possibleValue = try silent(getVariable("possibleId"));
This will benignly set possibleValue to undefined if the variable doesn't exist.
5
Answers
If you're just looking to find a single variable (or any of a small set of known ids) which may or may not be set, note that you can say
This will benignly set possibleValue to undefined if the variable doesn't exist.
Jokes aside it can't be impossible to make this magic happen since all the info is there, and is readable under "Show Code". I'll submit an IR.
As Arthur C. Clarke puts it so eloquently: