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 access data written to parts with setAttribute
luis_trueba
Member, Developers Posts: 9 ✭
Hi,
I'm attempting to write a program that analyzes some of the geometry of each part, and then writes the results into the parts in order for another app to pick it up and read it through the API. I've successfully written the data I need to the parts by using setAttribute, but I've been going through the API request list and have not yet found any returns that will contain the data I've written to the parts. Does anyone know where FS Attributes are stored, and if it's possible to access them through the API?
Thanks!
I'm attempting to write a program that analyzes some of the geometry of each part, and then writes the results into the parts in order for another app to pick it up and read it through the API. I've successfully written the data I need to the parts by using setAttribute, but I've been going through the API request list and have not yet found any returns that will contain the data I've written to the parts. Does anyone know where FS Attributes are stored, and if it's possible to access them through the API?
Thanks!
Tagged:
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565Hello and welcome!
The best way to get the attributes you've set is via the evaluate FeatureScript API. You can refer to to the developer portal help section titled "Feature list API" for an example of calling this API.
The FeatureScript function you provide can then:- Query for the relevant parts (possibly qEverything, possibly qAttributeQuery to filter for parts with your attribute type)
- Get the attribute as a variable via getAttributes
- Return the attribute or attributes
Let us know if you have any questions!
5
Answers
The best way to get the attributes you've set is via the evaluate FeatureScript API. You can refer to to the developer portal help section titled "Feature list API" for an example of calling this API.
The FeatureScript function you provide can then:
- Query for the relevant parts (possibly qEverything, possibly qAttributeQuery to filter for parts with your attribute type)
- Get the attribute as a variable via getAttributes
- Return the attribute or attributes
The value returned by the FeatureScript function will then be returned from the evaluate FeatureScript API call.Let us know if you have any questions!