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.
Reading feature related infromation
Kirankumar_Thimmegowda
Member Posts: 28 PRO
Is there any way to get the information added in feature script(samples below) through api.
throw regenError("This is a regen error");
throw regenError("This is a regen error");
reportFeatureInfo(context, id, "Some error found");
https://cad.onshape.com/documents/a63f2300d0234e62b89f906d/w/1432bb01183f19577aa937e2/e/32e2592e0830a05993a8a875
https://cad.onshape.com/documents/a63f2300d0234e62b89f906d/w/1432bb01183f19577aa937e2/e/32e2592e0830a05993a8a875
Tagged:
0
Answers
Basically i want to access information added as string(inside catch block through reportfeaturewarning, throw regenerror or any other better way) through api
https://cad.onshape.com/glassworks/explorer/#/
Otherwise, the standard way of extracting strings (possibly set via a custom FeatureScript) is by using the PartStudio featurescript endpoint, which takes a feature script function and evaluates it against a fully finished PartStudio. You can use this to fetch attributes or variables set via a custom feature, or compute information you need directly (using queries and whatnot).
Like Alex suggested, if you want the specific error, you would need to store it somehow - like in an attribute or variable that can be retrieved via the /api/partstudios/.../featurescript endpoint.