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
-
Are you trying to test if a part studio has errored via a regenError thrown by a custom feature via the Onshape API?
Software Developer at Epic Systems
FRC Design Mentor - Team 1306 BadgerBots0 -
@Alex_Kempen,
Basically i want to access information added as string(inside catch block through reportfeaturewarning, throw regenerror or any other better way) through api0 -
Okay, a couple things. If you throw a regenError, the part studio will stop regenerating and report an error state. It's possible the error message thrown is accessible via a documents or part studio endpoint; you can play around with glassworks and a part studio with an error to see if the information is available.
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).
Software Developer at Epic Systems
FRC Design Mentor - Team 1306 BadgerBots0 -
The api endpoint for /partstudios/.../features gives the "featureStates" property. But it only give if the feature has an error, but not what the error is.
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.0

