Allowing for mate connector selection. What's the correct syntax?

ry_gb
ry_gb Member, csevp, pcbaevp Posts: 273 PRO
edited December 2025 in FeatureScript

I'm testing out different query types and wanted to allow for users to select a Mate Connector. However, when I wrote out:
Filter" : EntityType.BODY && (…|| BodyType.MATE_CONNECTOR),
the feature dialog doesn't allow for mate connector selection or show the mate connector symbol until I add
|| AllowMeshGeometry.NO
as well. Doesn't make a ton of sense to me. Is there anything different I need to do?

Ramon Yip | glassboard.com

Best Answers

  • Konst_Sh
    Konst_Sh Member Posts: 170 PRO
    Answer ✓

    Just BodyType.MATE_CONNECTOR alone should work, also use "UIHint":UIHint.PREVENT_CREATING_NEW_MATE_CONNECTOR if you only want explicit mc's to be allowed

    CADSharp - Onshape custom programming services + Onshape mechanical design services

  • Matt_Shields
    Matt_Shields Member, Onshape Employees Posts: 1,000 PRO
    Answer ✓

    This works for me:

    annotation { "Name" : "Center", "Filter" : EntityType.VERTEX || BodyType.MATE_CONNECTOR, "MaxNumberOfPicks" : 1 }
    definition.centerPoint is Query;

  • MichaelPascoe
    MichaelPascoe Member Posts: 2,959 PRO
    edited December 2025 Answer ✓

    Here is a related post that may be useful for you: https://forum.onshape.com/discussion/15736/implicit-mate-connectors-act-differently-than-explicit-ones…

    And here is a quick way to get the implicit mate connector button to appear, just ensure there are multiple body options (not just one body filter option) and that MATE_CONNECTOR is one of them:

    annotation { "Name" : "myMate", "Filter" : BodyType.MATE_CONNECTOR || BodyType.MATE_CONNECTOR }
    definition.myMate is Query;
    
    image.png

    RENDERCAD - Photorealistic product rendering.
    CADSharp - Professional CAD + software consulting.

    ▚▞▚▞▚▞▚▞▚

Answers