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.

opSplit > opDeleteBodies called repeatedly on the same body from a loop

adamohernadamohern Member, OS Professional Posts: 216 PRO
I have a feature that splits a body with a plane using opSplit, then deletes half using opDeleteBodies. Works fine in isolation.

My intended use, however, is within a loop. I select multiple planes, a single body, and the feature loops through each plane lopping off the appropriate part of the body. 

The problem is that my split/delete function doesn't work in this context. I assume it has something to do with internal ID's changing during the split operation or something. Anyway, it works fine when run by itself, but not when trying to do it repeatedly to a single body.

Any hints?

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    I think we'll need a bit more information to help.  What is the error message you're seeing?  Can you paste the loop code?
    The usual issue with this type of thing is that ids of operations have to be unique (and hierarchical), so you need to do something like:

    for (var i in [0, 1, 2])
    {
       opSplit(context, id + i + "split", { ... });
       opDeleteBodies(context, id + i + "delete", { ... });
    }


    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
Sign In or Register to comment.