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.

Feature Request: help text in feature UI

dave_cowdendave_cowden Member, Developers Posts: 445 ✭✭✭
I'd like to put help text for users into the UI. Of course i have lots of comments in the feature code itself, but i'd like to have ability to put
a short description of each choice ( sometimes), and help text. 

I've also been unable to figure out how to display a friendly message to a user when there is a problem. 

Combined, this makes usability poor. 

Suppose, for the sake of argument, that i have the user selecting two planes, and they cannot be perpendicular.

(1) i have no way to tell the user "these planes must not be perpendicular" in the UI.
(2) the best i can do is 
 throw regenError ( ErrorNumber.INVALID_INPUT, [ definition.choice1, definition.choice2] );

which does highlight the choices, but doesn't tell the user what actually was wrong.

(3) there is no way in the preconditions to check that they are not perpendicular, so to make matters worse, unless the user happens to have the featurescript debug window open, the user will dismiss the box before realizing it is broken.

I think there should be solutions to all three of these. an overloaded signature for regenError with a message that displays in the UI, an annotation on the user inputs that allows setting a short description, and a single annotation somewhere on the feature itself that gives a block comment or help page. ( I think since this is large, it would ideally be displayed in a help bubble on request by the user ).

The inability to test complex conditions in the preconditions might be too difficult to change, since that's kind of baked in at the language level.





Answers

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 450
    I think your concerns mirror ours. The errors we can currently report are enumerated on ErrorStringEnum, rather than with plain strings, which is directly preventing FS writers from defining their own custom errors. It was implemented this way because, for Onshape features, we want to localize these errors into many languages, so those enum values actually indicate one of several translations of the error. We eventually want a solution which allows a FS writer to either localize their own errors or just report errors in English, but for now, the best you can do is to throw a generic "invalid input" or use another one of Onshape's errors used elsewhere (maybe SKETCH_PERPENDICULAR_FAILED?) :disappointed:

    On the UI side of things: When throwing a regen error, as you've done, the feature itself will be highlighted in red, and the specific error (i.e. the text for that specific ErrorStringEnum value) will be shown in the tooltip if the user hovers over the feature. Not terrible, but also not very discoverable.

    However, we also have another error reporting mechanism, which is designed for errors in a top level feature, of the form "Hey, this probably means you should just adjust your inputs":
    reportFeatureInfo(context, id, ErrorStringEnum.SKETCH_PERPENDICULAR_FAILED);
    ReportFeatureInfo() will pop up a message bubble every time the user changes the feature definition such that the error is newly triggered, or whenever the user opens the feature dialog while the error is present.

    You can also simply println() more info with any string you want, but the downside of that is that anything reported with println() isn't as immediately visible to the end user as the native Onshape errors are.

  • dave_cowdendave_cowden Member, Developers Posts: 445 ✭✭✭
    edited September 2016
    alas, the perpendicular sketch example was just made up-- is there a clever way i can add my own ErrorStringEnums? I completely understand the localization rationale-- it makes sense that you'd have a constant and a localization file. 

    So i just need ability to add my own ErrorStringEnums...


Sign In or Register to comment.