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.
How to properly use: setFeatureComputedParameter()
john_mcclary
Member, Developers Posts: 3,936 PRO
What am I missing?
This is all the info I see in the documentation
I've tried many times, but I cannot get the feature name to stick like I've seen in measureValue.fs and variable.fs
This is all the info I see in the documentation
I've tried many times, but I cannot get the feature name to stick like I've seen in measureValue.fs and variable.fs
0
Best Answers
-
MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭@john_mcclary
The parameter name has to be in the precondition for setFeatureComputedParameter to work.
PS: You don't have to use setFeatureComputedParameter to use # syntax in the feature name. You can just directly use #Name.5 -
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565FYI, in order to use #someValue in templates, you need either definition.someValue to be a parameter or setFeatureComputedParameter("someValue", ...). No need for both, but setFeatureComputedParameter is still useful for computed values that aren't inputs.
And yes, an individual feature's name and template are assigned when the feature is created, so if you're debugging this stuff and changing the feature name or template, you need to delete and recreate the feature in order to see the new name or template take effect.
2
Answers
The parameter name has to be in the precondition for setFeatureComputedParameter to work.
PS: You don't have to use setFeatureComputedParameter to use # syntax in the feature name. You can just directly use #Name.
IR for AS/NZS 1100
I was running in circles expecting the feature tree to update just by editing the feature.
Good to know you don't need setFeatureComputedParameter
And yes, an individual feature's name and template are assigned when the feature is created, so if you're debugging this stuff and changing the feature name or template, you need to delete and recreate the feature in order to see the new name or template take effect.