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.
What query will give me the solid body that owns a face?
dave_cowden                
                
                    Member, Developers Posts: 480 ✭✭✭                
            
                    I have a face, and I thought this would give me the body that owns it:
But that just gives me the face again. I also tried
but that gives the same thing too. The body is a user-created body so i do not have programmatic access to the id to use qCreatedBy.
This code works, but its really insane just to find the owning body:
Shouldn't you be able to find the solid body that owns a face using qOwnerBody? I think this code will generally work but its pretty nasty and there are some corners in which we could find multiple bodies if we happened to have a face on a boundary between two solids.
                
                var theBody = qOwnerBody(definition.face );
But that just gives me the face again. I also tried
var theBody = qOwnerBody(qOwnerBody(definition.face));
but that gives the same thing too. The body is a user-created body so i do not have programmatic access to the id to use qCreatedBy.
This code works, but its really insane just to find the owning body:
<div>    var tangentPlane = evSurfaceDefinition(context, {</div><div>            "face" : definition.face</div><div>    });</div><div>    </div><div>    var originalObject =qContainsPoint(qBodyType(qEverything(EntityType.BODY),BodyType.SOLID),tangentPlane.origin );</div>Shouldn't you be able to find the solid body that owns a face using qOwnerBody? I think this code will generally work but its pretty nasty and there are some corners in which we could find multiple bodies if we happened to have a face on a boundary between two solids.
0    
            
Answers
the last part should be
<div>    var tangentPlane = evFaceTangentPlane(context, {</div><div>            "face" : definition.surface,</div><div>            "parameter" : vector(0.5, 0.5)</div><div>    }); of course the above returns a surface, not a tangent plane.</div>This is a pretty large project, so like that other extrude weirdness I'll try to narrow it down to an easier repro before having you look into it