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.
Example of FeatureScript functions in Variable features?
I'm looking at the help documentation for variables here and I see that custom functions can be written with Featurescript syntax inside of a Variable feature. I understand the example given, but I'm curious if anyone has any examples of a time they found this functionality particularly handy. It seems like a powerful capability, but I'm having a hard time imagining a use-case for myself. Does anyone have anything cool they want to show?
Evan Reese
0
Comments
I'm trying to think of examples, but anything I can come up with involving calculations could just as easily be done with a combination of variables and configurations. So, I would think this would be most valuable in situations where you want to avoid typing the same expression multiple times or if there are things you could do in a function that go beyond the simple calculations? Would you be able to do queries or evaluations within these functions?
That's kind of where I'm stuck. I can't think of a function I'd run more than once or twice, in which case I may as well just type it as an equation, but the fact that it's there has me very curious about the scenarios where it's indispensable. There's got to be a few, right?
I can't say for sure, but I don't think queries or evals are possible in the functions.
That makes sense. I guess I'm just really hoping there's some perfect application for it because that would excite me.
Otherwise it would be handy to make a toolkit FS that holds a bunch of common functions as vars.
for example, the pitch dia of a sprocket.
I always just type it out long form in the dimension, but there are only two parameters, chain pitch and tooth count.
so it would be cool to just type #Sprocket_Pitch_dia(.75,11) and not have to remember if you need to multiply the pitch by sin() or divide.. (I get it wrong half the time)
now, this is an interesting idea! I like the toolkit concept. If someone works with a particular system that has common equations, then a feature could be written to turn each equation into a function to make downstream calculations way faster and less error-prone.
Bummer that the map didn't work. Any ideas on a workaround?
My issue was I had a "-" in the name, apparently that is not a valid variable name. My bad
Sorry if its a dumb question - I'm just starting to dig into featurescript.
But you could make your map in the same file if you want.