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?
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?
▚▞▚▞▚▞▚▞▚0 -
The use case is providing the user with functions such as C2C(pitch, pulley1, pulley2, belt), which would calculate the distance between two timing belt pulleys. The functions works as intended, however, mixing up the order of the parameters can result in more problems than just using a measurement of an online calculator, which would defeat the purpose of defining the function in OnShape
0
