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.
Determine which options were selected when previously using a feature to create a part?
ENG_1
Member Posts: 4 ✭
Is there a way to access a piece of information that was input by selecting an enum value to create a feature, the next time that feature is used?
For instance, if I made a feature to create cube with an enum option for filleted edges, would it be possible to then use featurescript to query that cube and determine whether or not the user chose to have filleted edges?
For instance, if I made a feature to create cube with an enum option for filleted edges, would it be possible to then use featurescript to query that cube and determine whether or not the user chose to have filleted edges?
Tagged:
0
Best Answers
-
lemon1324 Member, Developers Posts: 225 EDUI think the way to go about this would be to use attributes; the first custom feature would need to set an attribute on the geometry which could then be queried by following custom scripts.
I'd think carefully about whether you actually want this to happen though; it would mean your second feature can only operate on geometry created by your specific first feature, and hidden interactions can often make UI confusing.
Arul Suresh
PhD, Mechanical Engineering, Stanford University5 -
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭the first solution I can think about is to create in the feature a global variable named for example "<FeatureName>_state" and save to this variable information about user-selected options in the map type like
setVariable("<FeatureName>_state",{"firstApplication":false, "filleted":definition.filleted}) and so on
and the next feature will scan this variable by getVariable()
5
Answers
I'd think carefully about whether you actually want this to happen though; it would mean your second feature can only operate on geometry created by your specific first feature, and hidden interactions can often make UI confusing.
PhD, Mechanical Engineering, Stanford University
setVariable("<FeatureName>_state",{"firstApplication":false, "filleted":definition.filleted}) and so on
and the next feature will scan this variable by getVariable()
Say, for instance, you make two cube features, one of which has the fillet option and one which doesn't. Using attributes lets you respond to both of these in later features independently, rather than overwriting the Variable (which is necessarily a global variable).
PhD, Mechanical Engineering, Stanford University
https://cad.onshape.com/documents/5de745b789701c60bf75fd19/w/3d4893fbd20b641cfbce25c9/e/71100f5de8e6955281228275