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.
Using the API to query the origin of a mate connector.
billyzelsnack
Member Posts: 87 PRO
At this point I am just trying to get it to work in glassworks.
I may be way off but I think what I want to do is this:
My (very simple two parts and a revolute) assembly URL is this:
Auto-filling that into GET /assemblies/d/{did}/{wvm}/{wvmid}/e/{eid}/features will give me this Request URL:
(Sorry this is really long for completeness.)
So now I think that I want to call POST /partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/featurescript
1. Auto-fill again with the same URL and I get this Request URL (after execute):
However I have not been able to figure out how to format it for the Request Body.
Thanks.
I may be way off but I think what I want to do is this:
My (very simple two parts and a revolute) assembly URL is this:
Auto-filling that into GET /assemblies/d/{did}/{wvm}/{wvmid}/e/{eid}/features will give me this Request URL:
https://cad.onshape.com/api/v6/assemblies/d/4aa99028e075fd17f8cbb6c7/v/18d72dc7cc5d2583696cf3d5/e/be2e09e6ee4f95072f5d7d0d/featuresThe Response body it gives me is this:
(Sorry this is really long for completeness.)
{ "btType": "BTAssemblyFeatureListResponse-1174", "featureStates": { "MT1jIrNKZVU0Ug82s": { "btType": "BTFeatureState-1688", "featureStatus": "OK" } }, "isComplete": true, "features": [ { "btType": "BTMMate-64", "featureType": "mate", "mateConnectors": [ { "btType": "BTMMateConnector-66", "featureType": "mateConnector", "isHidden": true, "isAuxiliaryTreeMateConnector": false, "implicit": true, "name": "Mate connector", "version": 4, "namespace": "", "nodeId": "MXIlLUS0PW4sZ7AC1", "suppressed": false, "parameters": [ { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "Mkw+d//yVj8r0nHrR", "value": "ON_ENTITY", "enumName": "Origin type", "parameterId": "originType" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [ { "btType": "BTMInferenceQueryWithOccurrence-1083", "secondEntityQuery": "", "inferenceType": "CENTER", "entityQuery": "query=qCompressed(1.0,\"%B5$QueryM6S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA1C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6$FZn3uLutVaBppxk_2wireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdSc$F44L11HVQ4NZR4R5R6R7S7$isStartFR8CbA1S11.9$FMRy85wYa4hGDYf_2opExtrudeRbS8$CAP_EDGE\",id);", "path": [ "MyC+IUicC8i6oEtbZ" ], "nodeId": "F3kzQmoYVvkXUUH" } ], "parameterId": "originQuery", "nodeId": "M3PTa7nMAOe2REmgP" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [], "parameterId": "originAdditionalQuery", "nodeId": "MnGkJue/ltZZfAV4c" }, { "btType": "BTMParameterBoolean-144", "value": false, "parameterId": "realign", "nodeId": "M46YvKStD9fMQMNIX" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [], "parameterId": "primaryAxisQuery", "nodeId": "MEkNPHSgu77Dl9Bvh" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [], "parameterId": "secondaryAxisQuery", "nodeId": "MLfhTOpvWT0kFrMsj" }, { "btType": "BTMParameterBoolean-144", "value": false, "parameterId": "transform", "nodeId": "MTujfXG8DU+117FuS" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0.0*mm", "parameterId": "translationX", "nodeId": "MclH492vI28TzwZLX" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0.0*mm", "parameterId": "translationY", "nodeId": "MvO8pl6uaftp7I+OT" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0.0*mm", "parameterId": "translationZ", "nodeId": "MqQdvJDbMdul8fWit" }, { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "MjqOsKJkKjvsis9YH", "value": "ABOUT_Z", "enumName": "Rotation axis", "parameterId": "rotationType" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0.0*deg", "parameterId": "rotation", "nodeId": "M0yBCTGFooGn0uoWl" }, { "btType": "BTMParameterBoolean-144", "value": false, "parameterId": "flipPrimary", "nodeId": "MPzHKQekN5ezMeSa3" }, { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "Mj6TDwsGxsWo5kfmS", "value": "PLUS_X", "enumName": "Reorient secondary axis", "parameterId": "secondaryAxisType" } ], "returnAfterSubfeatures": false, "subFeatures": [], "featureId": "MXIlLUS0PW4sZ7AC1" }, { "btType": "BTMMateConnector-66", "featureType": "mateConnector", "isHidden": true, "isAuxiliaryTreeMateConnector": false, "implicit": true, "name": "Mate connector", "version": 4, "namespace": "", "nodeId": "MJIBaLiLgA73GGp9l", "suppressed": false, "parameters": [ { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "MrkJI+q3hJAgD5yaO", "value": "ON_ENTITY", "enumName": "Origin type", "parameterId": "originType" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [ { "btType": "BTMInferenceQueryWithOccurrence-1083", "secondEntityQuery": "", "inferenceType": "CENTER", "entityQuery": "query=qCompressed(1.0,\"%B5$QueryM6S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA1C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6$FEQIdV8BVgVFiil_3wireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdSc.1.8$9e8h2EnpIvK00startCapR4R5R6R7S7$isStartTR8CbA1S11.9$FyHdFPmgvYfhRPU_3opExtrudeRbS8$CAP_EDGE\",id);", "path": [ "MOF67g1zjISR3yEzL" ], "nodeId": "Fhs8ObFxXmpmB7R" } ], "parameterId": "originQuery", "nodeId": "Mezq4DzF8R8aH4R7c" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [], "parameterId": "originAdditionalQuery", "nodeId": "MXJg4pICn/SqJ2YcH" }, { "btType": "BTMParameterBoolean-144", "value": false, "parameterId": "realign", "nodeId": "MspKSi/Jhvjxryd0c" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [], "parameterId": "primaryAxisQuery", "nodeId": "MX2I/1oGXnGZvXnEv" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [], "parameterId": "secondaryAxisQuery", "nodeId": "MK1E1YSOgGDbuQhAU" }, { "btType": "BTMParameterBoolean-144", "value": false, "parameterId": "transform", "nodeId": "MbC0XNXt7I7JQZi89" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0.0*mm", "parameterId": "translationX", "nodeId": "MjO2aLegx/PUYUUM0" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0.0*mm", "parameterId": "translationY", "nodeId": "MOZtwVh5RwqcJg260" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0.0*mm", "parameterId": "translationZ", "nodeId": "M+iOwRSC5nd0wuGwg" }, { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "MyD24k1vrz8kc8G5w", "value": "ABOUT_Z", "enumName": "Rotation axis", "parameterId": "rotationType" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0.0*deg", "parameterId": "rotation", "nodeId": "MMrPconp7XzxGk/Ud" }, { "btType": "BTMParameterBoolean-144", "value": false, "parameterId": "flipPrimary", "nodeId": "MuauvFYP+Sq3qpNwC" }, { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "M82v1/WZQyukQAkKm", "value": "PLUS_X", "enumName": "Reorient secondary axis", "parameterId": "secondaryAxisType" } ], "returnAfterSubfeatures": false, "subFeatures": [], "featureId": "MJIBaLiLgA73GGp9l" } ], "name": "Revolute 2", "version": 2, "namespace": "", "nodeId": "MT1jIrNKZVU0Ug82s", "suppressed": false, "parameters": [ { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "rO72kZ6/C+5lCqHv", "value": "REVOLUTE", "enumName": "Mate type", "parameterId": "mateType" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [ { "btType": "BTMFeatureQueryWithOccurrence-157", "queryData": "", "featureId": "MXIlLUS0PW4sZ7AC1", "path": [], "nodeId": "MqtJZlGy/0m1ZOLhM" }, { "btType": "BTMFeatureQueryWithOccurrence-157", "queryData": "", "featureId": "MJIBaLiLgA73GGp9l", "path": [], "nodeId": "M+oRj/lBQHiGxq+iJ" } ], "parameterId": "mateConnectorsQuery", "nodeId": "ZzE2gOSQYmuQ2QXn" }, { "btType": "BTMParameterBoolean-144", "value": false, "parameterId": "mateOffsetEnabled", "nodeId": "k5OXCoz4RFWMc2Jh" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "mateOffsetDistanceX", "nodeId": "3+HwBzmnmgQmp5G5" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "mateOffsetDistanceY", "nodeId": "EXr6mKwjkwYEJrDA" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "mateOffsetDistanceZ", "nodeId": "iBJt70qT9I77T3DP" }, { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "5U5uyXloAcCyCuAE", "value": "ABOUT_X", "enumName": "Rotation axis", "parameterId": "rotationType" }, { "btType": "BTMParameterQuantity-147", "value": 0, "units": "", "isInteger": false, "expression": "0 deg", "parameterId": "rotation", "nodeId": "JH+B/e9xWiIasCee" }, { "btType": "BTMParameterBoolean-144", "value": true, "parameterId": "limitsEnabled", "nodeId": "XRTBfEQMvmrh4k12" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No minimum", "isNull": false, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "limitXMin", "nodeId": "hPF7qfoeaD/hLxTA" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No maximum", "isNull": false, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "limitXMax", "nodeId": "WQd9FUUnlfOEd+CM" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No minimum", "isNull": false, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "limitYMin", "nodeId": "DVASZdkKAnzlcreq" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No maximum", "isNull": false, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "limitYMax", "nodeId": "35yoIG5gFbm9uDle" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No minimum", "isNull": false, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "limitZMin", "nodeId": "xlJChpz2wdR+dEE6" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No maximum", "isNull": false, "units": "", "isInteger": false, "expression": "0 mm", "parameterId": "limitZMax", "nodeId": "XxZ964ZCAsCI8JVP" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No minimum", "isNull": false, "units": "", "isInteger": false, "expression": "0 deg", "parameterId": "limitAxialXMin", "nodeId": "WQQiBDoX41KLUpOd" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No maximum", "isNull": false, "units": "", "isInteger": false, "expression": "0 deg", "parameterId": "limitAxialXMax", "nodeId": "E6cCO1oqScbfAW4e" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No minimum", "isNull": false, "units": "", "isInteger": false, "expression": "0 deg", "parameterId": "limitAxialYMin", "nodeId": "44BFDV8duV4hnH13" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No maximum", "isNull": false, "units": "", "isInteger": false, "expression": "0 deg", "parameterId": "limitAxialYMax", "nodeId": "+Zkyvcu50xwx1rni" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "", "isNull": false, "units": "", "isInteger": false, "expression": "-45 deg", "parameterId": "limitAxialZMin", "nodeId": "14esMOI9RPVbMSB+" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "", "isNull": false, "units": "", "isInteger": false, "expression": "45 deg", "parameterId": "limitAxialZMax", "nodeId": "ukPHdXNsenkVUSHV" }, { "btType": "BTMParameterNullableQuantity-807", "value": 0, "nullValue": "No maximum", "isNull": false, "units": "", "isInteger": false, "expression": "0 deg", "parameterId": "limitEulerConeAngleMax", "nodeId": "44pUdsbbMUj7IG0K" }, { "btType": "BTMParameterBoolean-144", "value": false, "parameterId": "functionalconnection", "nodeId": "VS6kvxJZboCSVXKO" }, { "btType": "BTMParameterQueryWithOccurrenceList-67", "queries": [], "parameterId": "facestoconnect", "nodeId": "f9D0yR4n1oHjWfXs" }, { "btType": "BTMParameterBoolean-144", "value": true, "parameterId": "primaryAxisAlignment", "nodeId": "3C4gnuEEg0MpAOTy" }, { "btType": "BTMParameterEnum-145", "namespace": "", "nodeId": "ENePCYa+GGSJ/Tzd", "value": "PLUS_X", "enumName": "Reorient secondary axis", "parameterId": "secondaryAxisAlignment" } ], "returnAfterSubfeatures": false, "subFeatures": [], "featureId": "MT1jIrNKZVU0Ug82s" } ], "libraryVersion": 0, "serializationVersion": "1.2.2", "rejectMicroversionSkew": false, "microversionSkew": false, "sourceMicroversion": "3eda73e92ec7deeb3be50af1" }
So now I think that I want to call POST /partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/featurescript
1. Auto-fill again with the same URL and I get this Request URL (after execute):
https://cad.onshape.com/api/v6/partstudios/d/4aa99028e075fd17f8cbb6c7/v/18d72dc7cc5d2583696cf3d5/e/be2e09e6ee4f95072f5d7d0d/featurescript?rollbackBarIndex=-1What I don't know is how to fill the Request Body before I do the execute. I think I want to do this query from above:
{ "btType": "BTMInferenceQueryWithOccurrence-1083", "secondEntityQuery": "", "inferenceType": "CENTER", "entityQuery": "query=qCompressed(1.0,\"%B5$QueryM6S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA1C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6$FEQIdV8BVgVFiil_3wireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdSc.1.8$9e8h2EnpIvK00startCapR4R5R6R7S7$isStartTR8CbA1S11.9$FyHdFPmgvYfhRPU_3opExtrudeRbS8$CAP_EDGE\",id);", "path": [ "MOF67g1zjISR3yEzL" ], "nodeId": "Fhs8ObFxXmpmB7R" }
However I have not been able to figure out how to format it for the Request Body.
Thanks.
0
Best Answer
-
Nicolas_Amato Member Posts: 3 EDUInstead of requesting `features` you need to request the assembly document `/assembly/d/{did}/{wvm}/{wvmid}/e/{eid}` and the mate origin properties should be in `features` property of the root assembly.0
Answers
https://github.com/billyzelsnack/simple_onshape_exportstls