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.
Debugging featurescript failures and exceptions
stixpjr
Member Posts: 8 ✭✭
I've using onshape for a while, designing various models for 3d printing, mostly to learn, for fun & curiosity. I've toyed with featurescript a little, but I'm finding some failures hard to debug. Currently, I have a "jigsaw" script which generates a cut-like childrens jigsaw (yes, this works remarkably well 3d printed). However, if I alter the size, gap, try "randomly" reversing the joiners, I get a variety of exceptions, the main two being:
@opExtrude: EXTRUDE_INVALID_ENTITIES
or:
throw THICKEN_FAILED
This obviously isn't really a purpose that onshape was designed to cope with, but it performs remarkably well, considering my creative abuse. Any suggestions to debug this further?
The shared example is:
https://cad.onshape.com/documents/38a2ab62dc640db1a306c3ab/w/282299abd1dcd0658656c041/e/51a3f73f17e2bc5043a4eafa
@opExtrude: EXTRUDE_INVALID_ENTITIES
or:
throw THICKEN_FAILED
This obviously isn't really a purpose that onshape was designed to cope with, but it performs remarkably well, considering my creative abuse. Any suggestions to debug this further?
The shared example is:
https://cad.onshape.com/documents/38a2ab62dc640db1a306c3ab/w/282299abd1dcd0658656c041/e/51a3f73f17e2bc5043a4eafa
0
Comments
before the extrude, and see what it highlighted/printed to the console.
If you do that for one of the failing cases, and it looks like you are trying to extrude the correct entity, please feel free to post here again, and we can look into it more closely.
After fixing that, now I just get the "throw THICKEN_FAILED". Debug output is:
debug: Query resolves to 4 bodies (4 sheet)
which looks sane?Couple things to try:
First I would try doing each body individually, to see if one specific body is the problem:
You probably only want to have one of those debugs on at a time so you can piece out which thicken is failing.
Something else worth trying is:
and trying to thicken the faces rather than the bodies. You can also run the faces through the same loop from above too see if there is one or a few specific problem faces.
If you can make a Version of your document where this failure is occurring, and then post the link to that Version, it would be easy to look into.
https://cad.onshape.com/help/Content/versionmanager.htm
Nothing strange in the debug output: And the rendered face looks OK on screen.
The following is tied to a failing version:
https://cad.onshape.com/documents/38a2ab62dc640db1a306c3ab/v/b03bcf08a4a6ba3b56348d03/e/d884d38b90d792779b1742c1
I wouldn't expect to be able to thicken a shape like this very much because it will quickly become self intersecting at the sharp corners:
I am brainstorming some solutions for how you may be able to achieve what you want, but the simplest solution would to just be to soften the turn where the bump meets the rest of the piece. Are you working with a strict set of parameters, or could this shape be drawn a little differently? To test out whether this is the case, I suspect that if you turn down the gap to be low enough (without changing the geometry), there is probably some threshold where the thicken will start to succeed.
Interestingly, when I try to etch a spiral in the top surface, 0.5mm of the 2mm thickness, again, a thicken operation fails. This is not featurescript, just regular onshape objects and operations:
https://cad.onshape.com/documents/38a2ab62dc640db1a306c3ab/v/2a21d21c586757f8ea1abbd2/e/d884d38b90d792779b1742c1
It is the boolean postprocessing that is failing, not the thicken itself. If you switch to NEW it should probably work.
As to why the boolean is failing, it looks like we are doing some highlighting to point out the problem area:
It might be that the cut creates some non-manifold geometry in there, or possibly just that there is a bug in our geometry kernel. Is this etching intended as part of the final design, or just playing around to see when thicken fails or succeeds?
These slivers may be causing some instability.
However, it seems useful to shake out the flaky behaviour - if I'm finding flakes, I'm sure more serious users may also be finding these.
Given the geometry here, I can't see how there's non-manifold geometry created - but floating point math is hard!
I previously noticed the slivers on the end of the thickened splines; given what the thicken op does, these make sense - I can also see why this might be causing some instability. Relatedly: I only just discovered sketch slots - these seem to be a useful way to avoid thicken entirely, and have sane behavior on the spline ends. However, I haven't found a FeatureScript API to this function?
https://cad.onshape.com/documents/99ba468fc24964026815d021/w/e019d82fdc06bc8f3de46f34/e/4c9e925ef8330ec2b9c4b335
However, the built-in slot sketch tool also copes with splines as input - which require more than just a linear offset. I had originally thought that it would require offsetting each spline control point by the radius normal to the spline (at that point) - but that is too simplistic, and the transformation is deeper than that.
Onshape encountered a problem with your last operation. If the problem persists, please contact support. Support code 93aa18d7efc1f4b37e50921f.
I'm guessing the solver is unable to successfully solve based on the constraints. skConstraint is barely documented, given that it's mostly unnecessary, which makes it hard to debug. I also notice that the generated code includes a large blob of consts passed to skSetInitialGuess (undocumented) which likely helps the solver on its way.