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.

Given a mate connector how do you find the owner body for it?

pmdpmd Member, Developers Posts: 63 PRO
How do you go from a mate connector to the owner part?

I tried qOwnerBody(mc) but that seems to return the MC itself since MC's are bodies in their own right.

annotation { "Feature Type Name" : "OwnerOfMC" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        annotation { "Name" : "My Query", "Filter" : BodyType.MATE_CONNECTOR, "MaxNumberOfPicks" : 1 }
        definition.mc is Query;
        
    }
    {
        var mc_owner = qOwnerBody(definition.mc);
        debug(context, mc_owner);
    });

https://cad.onshape.com/documents/fc195edc346146cb553ba40a/w/ee195a6b5394daccf5b1a8d8/e/36e00d6dd082306d848814a5

The reason I want this is I am using the MC to indicate a reference point on a part and do not want the user to have select both the MC and the part.
Tagged:

Best Answer

Answers

  • marcus_bernsteinmarcus_bernstein Member, User Group Leader Posts: 35 EDU
    I'd bet there's a cleaner way, but depending on your application a qAdjacent may work fine. 
    Any chance Onshape is looking for interns?

    Philadelphia User Group Leader
  • pmdpmd Member, Developers Posts: 63 PRO
    I will do as you suggest - I sort of guessed implicit MC's might be a problem. I will read up on auto-populating - seems perfect for my case. 
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,048 ✭✭✭✭✭
    @kevin_o_toole_1
    Would we be able to use qPartsAttachedTo, like we can in Sheet Metal?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    @MBartlett21qPartsAttachedTo() will not give you Mate Connectors. a query like qOwnerPartsOfMateConnectors() is on our to-do list. In the meantime my suggestions above are the best solutions.
Sign In or Register to comment.