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.
How to go from an enum in a UI to a value or specification?
jack_white396
Member Posts: 7 EDU
Ok so I am fairly new and not great at featurescript, but I am making a feature that will generate metal tubing. So I have it to where the user selects from a few dropdown menus but I do not know how to make that selection determine the parameters for the part. Here is the feature as it stands-
FeatureScript 1803;
import(path : "onshape/std/geometry.fs", version : "1803.0");
export enum daave
{
annotation {"Name" : "Thick Wall"}
thiq,
annotation {"Name" : "Thin Wall"}
thin,
}
export enum diive
{
annotation {"Name" : "1x1"}
ONE,
annotation {"Name" : "2x1"}
TWO,
annotation {"Name" : "2x2"}
THREE,
}
annotation { "Feature Type Name" : "Tube Generator" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
annotation {"Name" : "Dimensions"}
definition.Dimensions is diive;
annotation {"Name" : "Thickness"}
definition.Thickness is daave;
annotation { "Name" : "Length" }
isLength(definition.myLength, LENGTH_BOUNDS);
}
{
// Define the function's action
});
0
Answers
Tube Generator - MP - Onshape document
Fun fact: I did this on my phone.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴