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.
Error when calling opSplitPart, CANNOT_RESOLVE_ENTITIES
Lee_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
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!
Tagged:
0
Best Answers
-
leon_poot Member, Developers Posts: 87 ✭✭✭You'll need to query the plane for "tool", not the variable.
opSplitPart(context, id + "splitPart1", { "targets" : qEntityFilter(qOwnerBody(face),EntityType.BODY), "tool" : qCreatedBy(id + "plane1", EntityType.BODY) });
No clue why it needs EntityType.BODY, but replacing it with anything else fails."A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless6 -
leon_poot Member, Developers Posts: 87 ✭✭✭This would my for-loop:
for (var i = 1; i < numLam; i += 1) { var splitPlane = opPlane(context, id + ("plane" ~ i), { "plane" : plane(tanPlane.origin + vector(i * lamWidth * millimeter, i * lamWidth * millimeter, 0 * meter), tanPlane.normal * -1, tanPlane.x), "width" : 6 * inch, "height" : 6 * inch }); 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 }); }
I saw in your document that you called opSplitPart twice, you only need it once per loop.
"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless6
Answers
opSplitPart(context, id + "splitPart1", { "targets" : qEntityFilter(qOwnerBody(face),EntityType.BODY), "tool" : qCreatedBy(id + "plane1", EntityType.BODY) });
No clue why it needs EntityType.BODY, but replacing it with anything else fails.So you'd end up with something like this inside your for-loop:
Hope that helps.
I saw in your document that you called opSplitPart twice, you only need it once per loop.