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.
access variable context of another feature
adamohern
Member, OS Professional Posts: 216 PRO
I'm using a FeatureList parameter to select a previously-created feature. Is it possible to look into that feature's context to access its definition variables and/or internal feature id's within the feature?
0
Comments
-
You can assign variables to the context with setVariable and retrieve them with getVariable. Note that these values can also be accessed by a user using #varName
You can also attach data to entities as attributes.
For your case, I'd probably use setVariable and getVariable using the featureId to store the relevant data.if (isTopLevelId(id)) { setVariable(context, id[0] as string, data); }
Note the isTopLevelId check. If any variable-setting features get patterned, they'll have nested ids which fail the check, and also won't be selectable via feature pattern.
0 -
What about accessing a query from the definition of the other feature? Is that possible?0
-
If the feature stores the query, sure. Otherwise (for like the query input to an extrude feature), not yet, but I would like it to be accessible.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0


