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.

How to find a body from a point or face on the body?

daniel_cravensdaniel_cravens Member Posts: 29
In feature script, I would like to be able to find the body that contains either a vertex or a face selected by the user. I don't want adjacent bodies. This is my script so far...

//////////////////////////////////////////////////////////////////////////////////////////////
//                             Split Model and Extrude Dove Tail Joint
//
//
annotation { "Feature Type Name" : "SplitJoin" }
export const SplitJoin = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        
        annotation { "Name" : "point on face to split", "Filter" : EntityType.VERTEX, "MaxNumberOfPicks" : 1 }
        definition.point is Query;
        
        annotation { "Name" : "face for split orientation", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }
        definition.face is Query;
            
        
            
    }
    {

    var splitPoint = evVertexPoint(context, {
                    "vertex" : definition.point
            });
            
    var tanPlane = evFaceTangentPlane(context, {
            "face" : definition.face,
            "parameter" : vector(0.5, 0.5)
    });
    
    var splitPlane = opPlane(context, id + "plane1", {
            "plane" : plane(splitPoint, tanPlane.x)
    });
    
    
    // I would like to find the body that contains either the splitpoint, splitplane, or tanplane??
    
        
    });


Comments

Sign In or Register to comment.