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.
set field default to variable
jonathan_mizrahi827
Member Posts: 5 PRO
I am using the FeatureScript "Wiring" provided by Onshape to do a bunch of routing. I want the size of the wires to be dependent on a variable, #WireDiameter. I would like for this variable to be the default value in the "diameter" field, so I don't have to copy it in every time. Is there any way to have the default values given in "isLength" be variables, rather than numbers?
0
Comments
A possible workaround is to copy the wiring feature and add an editing logic function that:
- Is only called on creation (i.e. leaves out the isCreating parameter)
- Checks the context for a #WireDiameter variable (via getVariable)
- If that variable exists, sets the "definition.diameter" field to its value
If coding this sounds worthwhile to you, let us know if you encounter any issues!One other issue that came up -- I noticed that in that feature if I set Starting Straightness or Ending Straightness to a variable, and then I change that variable, the displayed length of the wire does not update. To get it to update, I have to change it, and then change it back to the variable, and then it updates the displayed length. Is there a way to get it to update automatically when the variable value changes?