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.

Report sketch regeneration error to featurescript

evan_yu363evan_yu363 Member Posts: 3
Is there a way I could programmatically determine (ex. in featurescript) whether a sketch has failed to regenerate?

Context:
I'm trying to perform a computational optimization on a design by programmatically testing/searching a design space defined by onshape configurations. Certain configurations may be invalid, for example creating a triangle with side lengths 100, 100, 1000 (example of sketch failure being difficult to diagnose https://cad.onshape.com/documents/f885f435a14a2bdc0fb5b270/w/2f134941bb9f61f678806f3f/e/21205e69d39971ee6aea2d06). These invalid configurations usually cause sketches to fail to regenerate. In this way, the sketch can be considered a geometric constraint on the design/configuration space.

Currently when a sketch fails to regenerate, it returns to some default sketch which allows downstream features to regenerate correctly. This makes it difficult for me to programmatically determine whether a configuration is valid or not. Thus, I am looking for some solution to identify sketch failures.

A temporary solution I've found is to place mate connectors at the "default" sketch locations and determine failure by when a configuration does not move the mate connectors (by evaluating distance in Featurescript). However since I cannot control the "default" sketch, I can't trust this approach to consistently work.

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,681
    FS can only create or modify geometry. There’s no way to interrogate features as it cannot access their definitions. 
    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.