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.
Search
-
Re: Preserve ID through a try/catch?
@Jacob_Corder Thanks! It still doesn't solve the issue I'm trying to solve, which is that the "try extrude" body is different than the "catch extrude" body, which will make downstream things fail. A hack I can think of which I think would solve my issue might be: * Do a dummy "test extrude" to check whether it will fail *… -
Re: Preserve ID through a try/catch?
Thanks, @NeilCooke the Id method is more elegant that what I did, but has the same problem. I case I'm actually asking the wrong thing altogether, I'm solving for cases where extruding with draft will fail because there won't be any faces to draft. In those cases I'd like to just switch to extruding without draft without… -
Preserve ID through a try/catch?
I have a feature that I know will fail in certain scenarios, and I'd like to use a try/catch statement to first try my ideal one, and, if it fails, change some settings and try again. Here's what I've tested: var mainBody; try silent { extrude(context, id + "mainBody", mainDef); mainBody = qCreatedBy(id + "mainBody",… -
Re: Preserve ID through a try/catch?
Here's a simple example I coded just to check my syntax: const extrudeId = id + "extrude"; for (var i in [0, 1]) // max 2 loops - change these numbers to make extrude fail/succeed in this test { startFeature(context, extrudeId); try silent { opExtrude(context, extrudeId + "body", { "entities" : definition.myQuery,… -
Re: Preserve ID through a try/catch?

@NeilCooke Actually that wasn't the ticket after all, but it feels like the right solution if it can be made to work. Here's an example document of exactly the case I'm trying to solve for. The reason draft makes it fail is that there are no side faces to draft. With the native extrude, this doesn't matter, because you… -
Re: Preserve ID through a try/catch?
Fair. I certainly don't claim to be doing this feature The Right Way, but it is going to call 3 different extrudes, each of which have nearly identical definitions, but each with a few tweaks, and the UI is almost identical to the native extrude feature, so I thought I'd save myself some time and just use extrude(). It…
6 results