Adding part to assembly via API
I am trying to add an assembly into another assembly via API. Trying out the REST call in glassworks i get an error saying i am using a microversion even though i am using a version:
This is the document I am pasting:
Response bodyDownload { "message": "Microversions may not be used with linked document references", "status": 400, "code": 9999, "moreInfoUrl": ""}
|
|---|
I also don't understand how that API call should work since it only specifies one part/assembly. Is it the target or the payload?
I also have tried the same in python wihtout success but thats a different topic. Lets get this glassworks example working first. Any pointers welcome, thank you!
Comments
-
It would help to know the body you are using for your request. Your body is probably the problem.
I know you can do it with just:
documentId
versionId
elementId
isWholePartStudio=false
isAssembly=true
configuration={config if applicable}
You might be adding extra parameters that you don't need to add. The API can be a bit fussy if you include unnecessary parameterswww.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications2 -
Ok, I didn't fill in anything besides the autofill option in the glassworks. Now it works with the additional payload parameters.
Not able to get the inserted assembly to appear at a different location though - I am using:
{
"documentId": "5ec100e212a5fab5ff355415",
"elementId": "883aca11d7be9449d88a79a6",
"includePartTypes": [
"PARTS"
],
"transform" : [
1, 0, 0, 0,
0, 0, -1, 0,
0, 1, 0, 1,
0, 0, 0, 1
],
"isAssembly": true,
"versionId": "5aa8b24aaac7e7881e21e1f2"
}
Any hints, should this work?0 -
Thanks @Caden_Armstrong for the response, that helped. Just realizing that for a transform I probably have to use the occurrencetransforms.
Can you advise on how to use it, what do i need from the payload and how do i determine path?
{
"isRelative": true,
"occurrences": [
{
"fullPathAsString": "string",
"headInstanceId": "string",
"internalOccurrence": true,
"occurrenceWithoutHead": "string",
"occurrenceWithoutTail": "string",
"parent": "string",
"path": [
"string"
],
"rootOccurrence": true,
"tailInstanceId": "string"
}
],
"transform": [
0
]
}0 -
you're better off using "transformedinstances", inserted with a specific transform.
If you insert and then transform it requires a bunch of extra API calls, where as the transformedinstances endpoint lets you do all your insertions/transforms in a single call. With Onshape's API limits that can make a big difference to your usage.www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications0 -
thanks!
0
Categories
- All Categories
- 10.2K Community Support
- 4.6K General
- 194 Account and subscriptions
- 353 Data management
- 1.6K Product Feedback
- 215 New in Onshape
- 14 Onshape Labs
- 75 CAM Studio
- 35 PCB Studio
- 107 Simulation
- 209 Onshape Mobile
- 315 App Store & Partners Apps
- 8.2K Using Onshape
- 1.8K Drawings
- 2.3K FeatureScript
- 324 Learning Center
- 253 Education Community
