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 Category with Featurescript?
EvanReese
Member, Mentor Posts: 2,804 PRO
I'm trying to change a part category via FS. Some properties (like "Not Revision Managed") don't autocomplete, but can be set anyway as a "CUSTOM" property with the property ID. I hoped to do the same thing for a Category. Here's what I'm trying, but it isn't working. Has anyone else proven whether or not this is possible?
const categoryID = "57f3fb8efa3416c06701d625";
const categorySelectionID = "6983854abad5b851116b0a88";
setProperty(context, {
"entities" : entities,
"propertyType" : PropertyType.CUSTOM,
"customPropertyId" : categoryID,
"value" : categorySelectionID
});
0
Answers
Formatting the value is very counterintuitive, you need to put the property inside of a literal array - quotes and all:
(And the forum is being weird with formatting so you get a screenshot)
This is the value that goes into set property.
If you do multiple categories, you add a comma between each and surround them with quotes.
Experts in Onshape Automation - Custom Features and Integrated Applications