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.
Can we update configuration variable or simple variable using featurescript?
MBagwan
Member Posts: 15 ✭
I have length parameter(simple variable or configuration variable) say "a"=10 mm. Can we update this variable using featurescript. I tried following:
setVariable(context,"a",20*millimeter);
var updateda=getVariable(context,"a");
the updateda=20 mm.
But this will not update the variable on GUI. As well as the dimension configured with variable a doesn't update.
Can we do this using featurescript ?
Thanks in advance.
setVariable(context,"a",20*millimeter);
var updateda=getVariable(context,"a");
the updateda=20 mm.
But this will not update the variable on GUI. As well as the dimension configured with variable a doesn't update.
Can we do this using featurescript ?
Thanks in advance.
1
Comments
As with any variable, you can update the configuration variables inside features, but I wouldn't recommend it precisely because it leaves you in the confusing state you describe: You can control this value in the upper-left corner, and inside a custom feature. That feature override changes the value partway through regenerating your features, meaning features below see the new value (from the feature) and features above see the old value (from the configuration).
So, it seems likely there are more fitting tools in the Onshape toolbox for this job. What are you trying to accomplish?
First of all, I am not importing part studio in another model. I am working on the same model.
I have a model created using the revolving sketch. There is a configuration variable say "a" configured to one of dimension in the revolve sketch.
This model has many configurations. For each configuration, I have a set of values in the configuration table.
One of the values in this set represents the default value for the same dimension which is configured with the variable "a".
My task is to configuration variable "a"= default value from the set of values for the selected configuration.
I hope you will understand the problem.