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.

Cannot loop through opExtrude more than 10 times

Alex_KempenAlex_Kempen Member Posts: 248 EDU
Hello,
I was recently working on a FeatureScript when I discovered that an opExtrude contained in a loop was failing unexpectedly. I did some investigating, and soon discovered that it was consistently failing on the 10th iteration. Here is the extrude in question:
    println(id + unstableIdComponent(i) + "extrude");    
    try
    {
        opExtrude(context, id + unstableIdComponent(i) + "extrude", {
                    "entities" : ribGroups[i],
                    "direction" : direction,
                    "endBound" : BoundingType.THROUGH_ALL,
                    "startBound" : BoundingType.THROUGH_ALL
                });
    }
    catch
    {
        println(i);
        debug(context, ribGroups[i]);
        debug(context, direction);
    }
Note that the extrude is located inside the function extrudeRibs, and the id passed into extrudeRibs is id + "rib".
Here's the console:

I also tried a variety of different Id methods known to work for me in the past, including id + i + "extrude" and id + ("extrude" ~ i), but to no avail.

Interestingly, the error returned by opExtrude wasn't an Id error, but rather an @opExtrude: EXTRUDE_FAILED error, with warning message "Failed to extrude selections, check input". However, selecting a piece of geometry, receiving the error, and then deselecting a different piece of geometry would cause the geometry previously selected to suddenly work, and the opExtrude consistently fails on the 10th iteration regardless of the inputs fed into it. Thus, I'm at a loss for what the problem is.

Here's a link to the document:
https://cad.onshape.com/documents/0ab5631e453e51d5638fe9ad/w/b7ca19260ef980686fa7b547/e/b8c57994eb6e2b2bbd5cba2e

The extrude that is failing is on line 498, inside the function extrudeRibs. It is tied to the array parameter located in the rib tab.

CS Student at UT Dallas
Alex.Kempen@utdallas.edu
Check out my FeatureScripts here:



Best Answer

  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    edited October 2020 Answer ✓
    Okay after doing some more examination over the weekend, I discovered that looping through extrudes with BoundingType.THROUGH_ALL was resulting in errors due to the entities becoming to large. This problem also seemed to have been exacerbated by extruding THROUGH_ALL in both directions. I've made my document private again for now because it's kinda neat but also WIP, and I want to avoid sharing it to much until it's in a state where I'm happy with it. Hopefully soon!
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



Answers

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Definitely sounds strange, and I agree EXTRUDE_FAILED indicates a geometric problem, not an id issue.

    Can you make the document you linked public?
  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    edited October 2020 Answer ✓
    Okay after doing some more examination over the weekend, I discovered that looping through extrudes with BoundingType.THROUGH_ALL was resulting in errors due to the entities becoming to large. This problem also seemed to have been exacerbated by extruding THROUGH_ALL in both directions. I've made my document private again for now because it's kinda neat but also WIP, and I want to avoid sharing it to much until it's in a state where I'm happy with it. Hopefully soon!
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



Sign In or Register to comment.