Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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

KinKin Member Posts: 28 PRO
edited July 2023 in Community Support
Is there any way to get the information added in feature script(samples below) through api.
         
throw regenError("This is a regen error");
Tagged:

Answers

  • Alex_KempenAlex_Kempen Member Posts: 244 EDU
    Are you trying to test if a part studio has errored via a regenError thrown by a custom feature via the Onshape API?
    CS Student at UT Dallas
    Check out my FeatureScripts here:



  • KinKin Member Posts: 28 PRO
    @Alex_Kempen,
    Basically i want to access information added as string(inside catch block through reportfeaturewarning, throw regenerror or any other better way) through api
  • Alex_KempenAlex_Kempen Member Posts: 244 EDU
    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).
    CS Student at UT Dallas
    Check out my FeatureScripts here:



  • caden_armstrongcaden_armstrong Member, User Group Leader Posts: 127 ✭✭✭
    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.
Sign In or Register to comment.