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.
Is the origin in matedCS in Assembly Definition API a local coordinate or global coordinate?
C_Justin
Member Posts: 16 ✭
Is the origin in matedCS in Assembly Definition API a local coordinate or global coordinate?
Tagged:
0
Best Answer
-
Ethan_K Member, Onshape Employees Posts: 57Hi @C_Justin,
The first thing to note is that all the responses are in terms of meters, and do use scientific notation where needed, i.e.: -2.312964634635742E-17 is really close to 0 and within the Onshape tolerances of 0.
There are two flavors of mate connector responses within the API response. One is for describing the mate connector of a brought-in part, and the other is for describing a mated assembly mate connector. The one that the part owns (and is defined in the originating PartStudio) both are labeled with the CS relative to the CS of the occurrence. Here is an example response for this API call:{ "rootAssembly" : {
So the mate connector defined in the PS has a CS relative to the occurrence and is located at parts->mateConnectors->mateConnectorCS
"documentId" : "84baa7aab6ea46bdaea38be1",
"documentMicroversion" : "0b00d3b8050b78c46b499446",
"elementId" : "0bb88d382ac6e2176378f191",
"occurrences" : [ {
"path" : [ "MzbHnGVkP+/LJlZ7s" ],
"transform" : [ 1.0, 0.0, 0.0, 0.20000000000000007, 0.0, 1.0, 0.0, -1.3877787807814455E-17, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ],
"fixed" : false,
"hidden" : false
} ],
"instances" : [ {
"id" : "MzbHnGVkP+/LJlZ7s",
"name" : "Part 1 <1>",
"partId" : "JHD",
"isStandardContent" : false,
"configuration" : "default",
"type" : "Part",
"suppressed" : false,
"documentId" : "84baa7aab6ea46bdaea38be1",
"documentMicroversion" : "0b00d3b8050b78c46b499446",
"elementId" : "7eb0a76febc2fdbb7a343a26"
} ],
"features" : [ {
"featureType" : "mateConnector",
"id" : "MIcB7FY+NyCeX1IvD",
"suppressed" : false,
"featureData" : {
"name" : "Mate connector 1",
"occurrence" : [ "MzbHnGVkP+/LJlZ7s" ],
"mateConnectorCS" : {
"origin" : [ 0.24999999999999994, 0.0, 0.25 ],
"xAxis" : [ -1.6653345369377348E-16, 1.0, 0.0 ],
"yAxis" : [ 0.0, 0.0, 1.0 ],
"zAxis" : [ 1.0, 1.6653345369377348E-16, 0.0 ]
}
}
}, {
"featureType" : "mate",
"id" : "Mg6dQzTsYlypZLwXE",
"suppressed" : false,
"featureData" : {
"name" : "Fastened 1",
"mateType" : "FASTENED",
"matedEntities" : [ {
"matedOccurrence" : [ "MzbHnGVkP+/LJlZ7s" ],
"matedCS" : {
"origin" : [ -5.088522196198635E-17, 1.3877787807814455E-17, 0.0 ],
"xAxis" : [ 1.0, 0.0, 0.0 ],
"yAxis" : [ 0.0, -1.0, 0.0 ],
"zAxis" : [ 0.0, 0.0, -1.0 ]
}
}, {
"matedOccurrence" : [ ],
"matedCS" : {
"origin" : [ 0.2, 0.0, 0.0 ],
"xAxis" : [ 1.0, 0.0, 0.0 ],
"yAxis" : [ 0.0, -1.0, 0.0 ],
"zAxis" : [ -0.0, -0.0, -1.0 ]
}
} ]
}
} ]
},
"subAssemblies" : [ ],
"parts" : [ {
"documentId" : "84baa7aab6ea46bdaea38be1",
"documentMicroversion" : "0b00d3b8050b78c46b499446",
"elementId" : "7eb0a76febc2fdbb7a343a26",
"partId" : "JHD",
"bodyType" : "solid",
"configuration" : "default",
"isStandardContent" : false,
"mateConnectors" : [ {
"featureId" : "FaCcAun7ujfa74X_1",
"mateConnectorCS" : {
"origin" : [ -5.088522196198635E-17, 1.3877787807814455E-17, 0.0 ],
"xAxis" : [ 1.0, 0.0, 0.0 ],
"yAxis" : [ 0.0, -1.0, 0.0 ],
"zAxis" : [ 0.0, 0.0, -1.0 ]
}
} ]
} ],
"partStudioFeatures" : [ ]
}
The mate connector defined within the Assembly has a CS relative to the occurrence, and is found at rootAssembly->features->(the first one)->featureData->mateConnectorCS.
Feel free to poke around the originating document here.
In conclusion, both mateConnectorCS are defined within the CS of the occurrence.
5
Answers
The first thing to note is that all the responses are in terms of meters, and do use scientific notation where needed, i.e.: -2.312964634635742E-17 is really close to 0 and within the Onshape tolerances of 0.
There are two flavors of mate connector responses within the API response. One is for describing the mate connector of a brought-in part, and the other is for describing a mated assembly mate connector. The one that the part owns (and is defined in the originating PartStudio) both are labeled with the CS relative to the CS of the occurrence. Here is an example response for this API call:
So the mate connector defined in the PS has a CS relative to the occurrence and is located at parts->mateConnectors->mateConnectorCS
The mate connector defined within the Assembly has a CS relative to the occurrence, and is found at rootAssembly->features->(the first one)->featureData->mateConnectorCS.
Feel free to poke around the originating document here.
In conclusion, both mateConnectorCS are defined within the CS of the occurrence.
I got a mate located here. How can I then get the location of the mate in the world coordinate system?
Also,
It seems in the occurrence's coordinate system, the mate is not at the origin but the API gives "origin" : [ 2.5117617568793384E-18, 0.0, 0.0 ]", why this is not the case that the mate location is relative to the occurence's coordinate system?
This is the document, I think the mate connector connects at someplace near the origin but not the origin(not within 2.5117617568793384E-18)?
Our length tolerance is 10 nanometers (1e-8), anything difference smaller than that we would consider 0.