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.
FeatureScript fault

I have a fault in this script.
mismatched input ')' expecting {'[', 'box', '::', 'boolean', 'number', 'string', 'array', 'map', 'builtin', 'function', 'undefined', '{', BOOLEAN, NUMBER, ID, STRING}
19:6 Feature Studio 1
Code:
FeatureScript 2581;
import(path : "onshape/std/common.fs", version : "2581.0");
annotation { "Feature Type Name" : "Set Part Appearance" }
export const stetPartAppearance = defineFeature function(context is Context, id is Id, definition is map)
precondition
{
annotation { "Name" : "Part to modify", "Filter" : EntityType.BODY }
definition.part is Query;
}
{
// Set the appearance with the desired transparency (0.5)
setProperty(context, {
"entities" : definition.part,
"propertyType" : PropertyType.APPEARANCE,
"value" : color(1, 1, 1, 0.5) // RGB (1,1,1) with 0.5 alpha for transparency
});
});
My idea: a feature script that sets the appearance to 50% when the part is actively selected.
Thank you for your support
Hansjürg
Comments
defineFeature(
Hello Neil
What exactly would you like to have better defined?
The error message is there.
“ mismatched input ')' expecting {'[', 'box', '::', 'boolean', 'number', 'string', 'array', 'map', 'builtin', 'function', 'undefined', '{', BOOLEAN, NUMBER, ID, STRING} ” In the last line at the second “ }); ”
What should the script do?
Set the appearance to 50% for a part activated with the mouse. However, the color should not be changed. This is certainly still wrong in the code.
Thanks for the help.
Hansjürg
I was merely pointing out that you are missing a parenthesis after defineFeature.
Thank you for the further explanation. It has helped.
I am an absolute greenhorn in the script area.