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.

query input validation

adamohernadamohern Member, OS Professional Posts: 216 PRO
Is there a way to reject a query selection based on arbitrary criteria? For example, what if I wanted to accept a face as an input, but I wanted to reject any face that lacks at least one linear edge? What if I wanted to only accept circular faces, blue faces, or faces whose Normal points 37 degrees North?
Tagged:

Comments

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 447
    Unfortunately, no, these filters can't be arbitrary, and none of the specific options you listed are supported. You've probably seen the documentation for query parameter annotations which tells you you can filter by EntityType, BodyTypeGeometryType, ConstructionObject, SketchObject, and EdgeTopology.

    Probably the way to handle such requirements is allow selection of a broader set of things, and call reportFeatureInfo() to pop up a message letting the user know that their face didn't have a linear edge or whatnot.

    Right now, reportFeatureInfo() only allows an enum full of errors written for Onshape features (this was done for security and translatability), but you'll be able to pass in any string you want in the very near future. println() is an okay stand-in for the short interum.

  • adamohernadamohern Member, OS Professional Posts: 216 PRO
    Great, thanks!
  • traveler_hauptmantraveler_hauptman Member, OS Professional, Mentor, Developers Posts: 419 PRO
    edited April 2016
    @kevin_o_toole_1 Unless you guys are completely refactoring the library with a new error.fs, it could be useful to add an ErrorStringEnum.FEATURESCRIPT_ERROR with a generic message that directs the user to the Notices flyout.

  • john_f_carrjohn_f_carr Onshape Employees Posts: 74
    @kevin_o_toole_1 Unless you guys are completely refactoring the library with a new error.fs, it could be useful to add an ErrorStringEnum.FEATURESCRIPT_ERROR with a generic message that directs the user to the Notices flyout.

    We have an improvement coming soon to allow custom error messages.
  • john_f_carrjohn_f_carr Onshape Employees Posts: 74
    We released the update a couple hours ago.  Check out the new versions of regenError in error.fs.  This will only work in new documents; your old feature studios will see the old version of std.
Sign In or Register to comment.