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.
retrieve setVariable
mko_sc
Member Posts: 24 PRO
After creating variables with:
import(path : "onshape/std/geometry.fs", version : "1472.0"); const mm = millimeter; annotation { "Feature Type Name" : "write" } export const write_Var = defineFeature(function(context is Context, id is Id, definition is map) precondition { } { setVariable(context, "VarCode1" , 1 * mm); setVariable(context, "VarCode2" , 2 * mm); setVariable(context, "VarCode3" , 3 * mm); setVariable(context, "VarCode4" , "cip4"); setVariable(context, "VarCode5" , "ciop5"); });How can I "retrieve" them for another document so that they are usable with #VarCode1read ?
import(path : "onshape/std/geometry.fs", version : "1472.0"); import(path : "5799c11b612193edf562abdc", version : "cf616b0c1992daddb8a4e7a3"); annotation { "Feature Type Name" : "read" } export const read_Var = defineFeature(function(context is Context, id is Id, definition is map) precondition { } { var VarCode1read = try (getVariable(context,"VarCode1")); });after geometry i imported "wire".
Tagged:
0
Best Answer
-
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭In this document you can find both approaches. In feature studio 1 the const is decleared, in feature studio 2 fs1 is imported and variables from fs1 are used in the feature body where they are set to context variables, this feature is called in part studio 1, so that variables are now in its context. In fs3 part studio 1 is imported and context variable is extracted. This feature prints this variable value in the console of part studio 2.
0
Answers
for "write" everything is clear,
I did:
but for the "read" it doesn't work ("build with 0 argument")
Thanks again
..