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.
evCollision doesn't seem to work
I can't get all 8 "Clash type" results when clashing solid bodies. Here's what I can get:
INTERFERE = Volumes and faces are intersecting
ABUT_NO_CLASS = only faces are intersecting
TOOL_IN_TARGET = only volumes intersect tool contained
TARGET_IN_TOOL = only volumes intersect target contained
NONE = ????????
EXISTS = ????????
ABUT_TOOL_IN_TARGET = ????????
ABUT_TOOL_OUT_TARGET = ????????
annotation { "Feature Type Name" : "Collision Type Testing", "Feature Type Description" : "" } export const collision = defineFeature(function(context is Context, id is Id, definition is map) precondition {annotation { "Name" : "Tools", "Filter" : EntityType.BODY&&BodyType.SOLID} definition.tools is Query; annotation { "Name" : "Targets", "Filter" : EntityType.BODY&&BodyType.SOLID} definition.targets is Query; } { var tools = definition.tools; var targets = definition.targets; for(var i=0;i<8;i+=1) { var collisionArray = evCollision(context, { "tools" : qNthElement(tools, i), "targets" : qNthElement(targets, i) }); print("Collision("~i~")-"); for(var collision in collisionArray) { print(collision["type"]~","); } println(); } });
gets us this result:
Collision(0)-
Collision(1)-INTERFERE….
Collision(2)-ABUT_NO_CLASS…..
Collision(3)-ABUT_NO_CLASS…..
Collision(4)-ABUT_NO_CLASS…..
Collision(5)-INTERFERE…..
Collision(6)-TARGET_IN_TOOL
Collision(7)-TOOL_IN_TARGET
I was expecting:
Collision(0)-NONE
Collision(1)-INTERFERE
Collision(2)-EXISTS
Collision(3)-ABUT_NO_CLASS
Collision(4)-ABUT_TOOL_OUT_TARGET
Collision(5)-ABUT_TOOL_IN_TARGET
Collision(6)-TARGET_IN_TOOL
Collision(7)-TOOL_IN_TARGET
Why was I wrong?
Comments
Hi there! You're right, evCollision is quite tricky to use correctly and our documentation is a bit limited. I have filed a documentation bug for evCollision. In the meantime:
Your testbed is very elegant but doesn't cover all of the possible topological types.
EXISTS: In Onshape we have several things you might think of as "edges" (edge of a body, line in a sketch, curve) but under the hood these aren't all the same. Sometimes we create what's called a "wire body" to represent an edge. A wire body is a body but it has only 1 dimension.
You can "get to" the body specified by a sketch edge (through filtering) or creating curves and select them.
For collisions between two 1-dimensional bodies, does containment mean anything? Does abutment? (They don't, but it took me a bit to think through this). Because these concepts don't mean anything,
wethe parasolid kernel just returns EXISTS. Here's a screen showing the result of anevCollision
between two curves:https://cad.onshape.com/documents/fbaa3ed3488b3b8ae9e43279/w/b46702da3570a73396c3c9bf/e/627d935caa91d9fa77435469
@jnewth_onshape amazing sir thank you for the follow up :D ! this has been bugging me for a while