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.

Error when calling opSplitPart, CANNOT_RESOLVE_ENTITIES

Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭
Hello all, yet again I have another error, but in a different script this time. I am creating a script that splits a part into laminations, for use when creating counter tops out of many boards for example. I am using a for loop with the variable i to do this.

The user selects the face which they want the board length to be and an edge for the direction. Then they specify the number of boards they want. I then use the edge to get the width and divide that by the number of boards. Then I create a construction plane such that its origin is offset by the thickness of each board. I am doing this in the for loop, so on each iteration, the plane offsets another thickness each time.

Then the error... I am using opSplitPart() with the target as qOwnerBody(face) and the tool as the construction plane. However, I have an error of CANNOT_RESOLVE_ENTITIES. What am I doing wrong?
https://cad.onshape.com/documents/58d26491dbd4820fd5e392c8/v/d8e57c57dc9ea9c3ec23e7cf/e/3f67a0bdb932d66d53e4aa1c

Thanks
Lee Hesketh
There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!

Best Answers

Answers

  • Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭
    Thank you so much!
    There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
  • Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭
    Now, for some reason it only splits once. Any ideas?
    There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
    I was wondering the same thing. I found a trick: qSplitBy(featureId is Id, entityType, backBody is boolean), and then all you need to do is loop through the planes and newly-split bodies.

    So you'd end up with something like this inside your for-loop:
    var targets;
    if (i == 1)
    {
        targets = qEntityFilter(qOwnerBody(face), EntityType.BODY);
    }
    else
    {
        targets = qSplitBy(id + ("splitPart" ~ (i - 1)), EntityType.BODY, false);
    }
    var tool = qCreatedBy(id + ("plane" ~ i), EntityType.BODY);
    
    opSplitPart(context, id + ("splitPart" ~ i), {
                "targets" : targets,
                "tool" : tool
            });
    Hope that helps.
    "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
  • Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭
    So what would the whole for loop look like?
    There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
  • Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭
    I am now getting a duplicate error
    There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
  • Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭
    Now it works for some reason. Thanks!
    There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
Sign In or Register to comment.