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.
Retrieve mate connector data (host Part and entity) by id
I am trying to find the specific mate connectors that relate to a fastener mate in an Assembly. So I understand I can GET:
/assemblies/d/{DID}/w/{WVMID}/e/{EID}
and this provides under rootAssembly.features[i].featureData.matedEntities a mated Occurrence as below:
{
"id": "MbgTxbQ4oxWjiJC0b",
"featureType": "mate",
"suppressed": false,
"featureData": {
"mateType": "FASTENED",
"matedEntities": [
{
"mateConnectorCS": { …
},
"matedOccurrence": [
"MadTjo0bZeUt9XtjX"
],
},
{
"mateConnectorCS": { …
},
"matedOccurrence": [
"MIJboKuG+hf+FkD0E"
],
……
}
],
"mateLimits": {},
"name": "Fastened 7"
}
}
Then I match the "matedOccurrence"s to their associated Parts. Such as
MIJboKuG+hf+FkD0E to the Part under the rootAssembly.instances. I now have the Part the mate Occurance relates to (in this case it is a Sketch Part).
I also store the id of the mate (that is the id of the fastener mate):
"id": "MbgTxbQ4oxWjiJC0b"
and the Part it relates to
"instances": [
{
"id": "MIJboKuG+hf+FkD0E",
"type": "Feature",
"name": "Sketch 1 <1>",
"suppressed": false,
"featureId": "Fzd9eZb9Emg78u7_0",
"fullConfiguration": "default",
"configuration": "default",
"documentId": "edcc4c3a997b003b9ea3f6c7",
"elementId": "a9625780c2df43eb95febd32",
"documentMicroversion": "3a845a66e527ac32284b6c39"
},
Then I use:
/assemblies/d/{DID}/w/{WVMID}/e/{EID}/features
I get this data and look under features.parameters to find a feature_id (or node_id, sometimes these are the same value..?) that matches my id I retrieved from before.
I get a match and now I have the mate connector featureId that refer to this fastened mate I am interested in. Like so:
{
"btType": "BTMMate-64",
"featureType": "mate",
"suppressionState": null,
"parameterLibraries": [],
"returnAfterSubfeatures": false,
"subFeatures": [],
"namespace": "",
"version": 2,
"name": "Fastened 7",
"parameters": [
{
"btType": "BTMParameterEnum-145",
"namespace": "",
"nodeId": "6dB+XTz7YwcXVNwP",
"libraryRelationType": "DEFAULT",
"enumName": "Mate type",
"value": "FASTENED",
"parameterId": "mateType",
"parameterName": ""
},
{
"btType": "BTMParameterQueryWithOccurrenceList-67",
"libraryRelationType": "DEFAULT",
"queries": [
{
"btType": "BTMPartStudioMateConnectorQuery-1324",
"path": [
"MadTjo0bZeUt9XtjX"
],
"nodeId": "FSsbOIAYR2RbR4u",
"featureId": "FnO1DRDT9XVeOP3_1",
"queryData": ""
},
{
"btType": "BTMPartStudioMateConnectorQuery-1324",
"path": [
"MIJboKuG+hf+FkD0E"
],
"nodeId": "F8jnseQciksCVo8",
"featureId": "FAKaWOke4G3XVzS_0",
"queryData": ""
}
],
"nodeId": "f7ObkOh9Af1P0g+r",
"parameterId": "mateConnectorsQuery",
"parameterName": ""
},…
],
"nodeId": "MbgTxbQ4oxWjiJC0b",
"featureId": "MbgTxbQ4oxWjiJC0b",
"suppressed": false
}
Is there a quicker way to get data about a mate, such as a fastened mate, which includes:
The mate connector properties such as the Part it resides in? (name,document and element id, etc.)
For instance can I just use the feature id "MbgTxbQ4oxWjiJC0b" and use a GET "details for this feature", as an example, API endpoint?
I want to get the part it resides in and the entity that hosts it (In this case it is the midpoint of a sketch line)