Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
regenError message not displayed in dialog tooltip
brett_sutton
Member Posts: 42 ✭✭✭
I'm trying to modify the auto layout tool to improve the error messages and a few other issues.
I'm trying to use regenError to display a useful message in the auto tools dialog box. (e.g. when the title goes red you can hover to see the error details).
My reading of the documentation suggest that the error passed to regenError should be displayed as the tooltip, but no such luck.
I've tried a couple possible variants;
the original
// throw regenError(ErrorStringEnum.TRANSFORM_FAILED, ["cutSheet"]);
// variant one
throw regenError("Not enough doodads to create widget. Please select more doodads.", ["cutSheet"]);
// variant two
//throw "Cut sheet is smaller than largest part plus twice the spacing,";
// variant three
throw regenError("Not enough doodads to create widget. Please select more doodads.");
Variant three makes the most sense.
In each case the error message is not displayed anywhere, which isn't really useful.
What am I doing wrong?
Here is a version of the script:
https://cad.onshape.com/documents/58809db1cb421510b0d6d758/v/3da0629ac699ec4f63aab012
I'm trying to use regenError to display a useful message in the auto tools dialog box. (e.g. when the title goes red you can hover to see the error details).
My reading of the documentation suggest that the error passed to regenError should be displayed as the tooltip, but no such luck.
I've tried a couple possible variants;
the original
// throw regenError(ErrorStringEnum.TRANSFORM_FAILED, ["cutSheet"]);
// variant one
throw regenError("Not enough doodads to create widget. Please select more doodads.", ["cutSheet"]);
// variant two
//throw "Cut sheet is smaller than largest part plus twice the spacing,";
// variant three
throw regenError("Not enough doodads to create widget. Please select more doodads.");
Variant three makes the most sense.
In each case the error message is not displayed anywhere, which isn't really useful.
What am I doing wrong?
Here is a version of the script:
https://cad.onshape.com/documents/58809db1cb421510b0d6d758/v/3da0629ac699ec4f63aab012
Tagged:
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565The issue here is that you're using an old version of the standard library, which doesn't have the version of regenError that takes a custom string (Auto layout was one of the earliest trials of using custom features, so that version is quite out of date!)
Eventually we'll have better workflows for seeing that FeatureScript imports are out of date and updating. For now, you can manually change the top FeatureScript version to 477, and the std import version to 477.0. When you do this, you'll also need to delete the "min" and "max" values from the bound specs defined in the Auto Layout Config tab (we've simplified how defining these works, so when upgrading we force you to use the new version).
The actual error produced in this case was "no overload found for function regenError(string)", which indicates that the library (the old one) was missing that function. In general, when debugging errors like this, you can always open the FeatureScript notices pane while in a Part Studio to see the full FeatureScript error with a stack trace. Stay tuned as well for an update which will allow to you see these runtime errors immediately in the Feature Studio!
5
Answers
Eventually we'll have better workflows for seeing that FeatureScript imports are out of date and updating. For now, you can manually change the top FeatureScript version to 477, and the std import version to 477.0. When you do this, you'll also need to delete the "min" and "max" values from the bound specs defined in the Auto Layout Config tab (we've simplified how defining these works, so when upgrading we force you to use the new version).
The actual error produced in this case was "no overload found for function regenError(string)", which indicates that the library (the old one) was missing that function. In general, when debugging errors like this, you can always open the FeatureScript notices pane while in a Part Studio to see the full FeatureScript error with a stack trace. Stay tuned as well for an update which will allow to you see these runtime errors immediately in the Feature Studio!