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.
Creating a custom function to be used in the editor

I'm trying to create a custom function in a featurescript, that will be available to the user after using that featurescript. I know you can use setVariable
to define the function, but I want to add the type hints such as in functions like sin
(it apperas at sin(x)), since the function currently takes 4 parameters which could be mixed up. Additionally, I'd like to define constants like for example PI
. How can I achieve this?
0
Answers
Creating constants and adding type hints to functions at the part studio level isn't currently possible.
The best work around I can think of is to have a custom feature that handles the functions and creates a variable for them. For example, the user would open the feature and choose their function, then the feature would auto propagate an array with the optional inputs of the function and output a variable with the correct value.
What is your use case? Perhaps there is another way to achieve the control you want. Do you have an example document?
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴