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.
Need help with feature naming template
darren_13
Member, Developers Posts: 119 PRO
Hi, I am struggling with the feature naming template and have already checked most posts currently on the forums but from what I can tell my example should work:
feature definition:
annotation { "Feature Type Name" : "Profile Generator", "Manipulator Change Function" : "flipManipulators", "Feature Name Template" : "Aerofoil = #name", "Editing Logic Function" : "old"}
in main body:
feature definition:
annotation { "Feature Type Name" : "Profile Generator", "Manipulator Change Function" : "flipManipulators", "Feature Name Template" : "Aerofoil = #name", "Editing Logic Function" : "old"}
in main body:
setFeatureComputedParameter(context, id, {
"name" : "name",
"value" : 5
});
this gives a feature name of: Aerofoil = ?
If this isn't enough I can post a link but its
I changed the value to numerical because I read somewhere that it doesn't like strings? and also from checking the variable feature script what is the difference between ### and # used for ###name and #value
this gives a feature name of: Aerofoil = ?
If this isn't enough I can post a link but its
I changed the value to numerical because I read somewhere that it doesn't like strings? and also from checking the variable feature script what is the difference between ### and # used for ###name and #value
Tagged:
0
Comments
and
and add a new feature
I would expect that code to work. Can you post an example of a failing document? @konstantin_shiriazdanov is right that templates are fixed at the time of feature creation, we do not retroactively change existing features' templates, so you will need to create a new feature to test.
On the "###" question, Onshape allows escaping "#" as "##", so the template "###name" will display a "#" literal then the computed name.
https://cad.onshape.com/documents/95877be3b17f49277e87a2c3/w/b503830fd20472014beb1221/e/6a7730b786a3030938febbe7
under profile generator (new) and the main script. I moved it up to line 266.
I was creating new features to test, so that shouldn't be the issue.
@konstantin_shiriazdanovcheers ill try that now.
I believe your issue is that something within the feature is failing, which causes the whole feature to be aborted, reverting any effect the feature had (including setFeatureComputedValue).
Perhaps seeing a question mark only in the case the feature fails is fine for you. If not, the only computed values which are always set (even when the feature is aborted) are the parameters on the definition. So one option is to make an ALWAYS_HIDDEN parameter on the definition which is set via editing logic. Check out variable.fs for an example of this!
Thanks for your help,
Darren
Kind regards,
Darren