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.


Evaluate existing FeatureScript using API

morteza_karimimorteza_karimi Member Posts: 13
I understand the 'Evaluate FeatureScript' endpoint takes in "script" and "queries" in the body of request for API call and I have had some luck using the API this way.
But I keep thinking there should be a way to reference an existing FeatureScript that lives in a document. Does anyone have any experience doing this?

P.S. Aside from convenience, one of the reasons I'm looking to do this is that the original method limits you from using "import" statements as your script needs to be purely a function.


  • Options
    ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,176
    You can't do this directly, but what I would recommend is exposing your "existing FeatureScript" as a custom feature, using the "Add Feature" API to add the custom feature to the part studio, use "Evaluate FeatureScript" to get the output of the custom feature (the custom feature might store the output as a variable, for example, and the FeatureScript you evaluate will be a getVariable call).  Then you can delete the feature using the API.  This is just a workaround -- please submit an improvement request for removing the restriction on imports in the evaluate API call.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • Options
    morteza_karimimorteza_karimi Member Posts: 13
    Thank you @ilya_baran , It would be great to have that option in the future, I'll go ahead and submit an improvement request. But your workaround works for what I need to do now.

Sign In or Register to comment.