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.
"Create and transform assembly instances" post request example
connor_holjes
Member Posts: 9 ✭
in General
Can anyone post an example of the body for this? Just looking to insert a part into an assembly with some given translation and rotation...
0
Best Answers
-
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646Hi @connor_holjes
Currently, assembly transformations mustn't change the geometry of the part being inserted/transformed. For this reason, certain affine transforms (e.g. shears, reflections) are not valid assembly transforms. If you want a mirrored version of your part, you would have to mirror it in the part studio, and then insert that into the assembly.
Sorry for the trouble; if you would like to see this functionality implemented please vote on this improvement request:
https://forum.onshape.com/discussion/5763/mirror-feature-for-assembly-workflow
Jake Rosenfeld - Modeling Team5 -
mark_noyes Member, Onshape Employees, Developers Posts: 21The configuration query parameter value is an encoded configuration string. If you don't already have this as the output of another API call you can get one by calling the POST /api/elements/d/:did/e/:eid/configurationencodings API. Before calling that you probably need to call the GET /api/partstudios/d/:did/w/:wid/e/:eid/configuration API in order to determine the correct id values to use.
As an example, I just created a simple part studio configuration with one input with valid values Smaller (originally with the name "Default") and Bigger. I call the get configuration API and it tells me that there is one configuration parameter:{ "type": 105, "typeName": "BTMConfigurationParameterEnum", "message": { "enumName": "List_KAziYCON7D1YBU_conf", "options": [ { "type": 592, "typeName": "BTMEnumOption", "message": { "option": "Default", "optionName": "Smaller" } }, { "type": 592, "typeName": "BTMEnumOption", "message": { "option": "Bigger", "optionName": "Bigger" } } ], "defaultValue": "Default", "parameterId": "List_KAziYCON7D1YBU", "parameterName": "Configuration" } }
Suppose I want what the user sees as Configuration=Smaller. I need to specify id values rather than name values to the configurationencodings API, so I will use parameterId="List_KAziYCON7D1YBU" and parameterValue="Default".
I can then call the configurationencodings API passing the body:<div>{ "parameters": [</div><div> { "parameterId": "List_KAziYCON7D1YBU",</div><div> "parameterValue": "Default" }</div><div> ]</div><div>}</div>
So correct configuration string to pass to the insert and transform instance API is "List_KAziYCON7D1YBU=Default".
and it returns the response:<pre>{</pre><pre> "encodedId": "List_KAziYCON7D1YBU=Default"</pre><pre>}</pre>
5
Answers
"transform": [
Currently, assembly transformations mustn't change the geometry of the part being inserted/transformed. For this reason, certain affine transforms (e.g. shears, reflections) are not valid assembly transforms. If you want a mirrored version of your part, you would have to mirror it in the part studio, and then insert that into the assembly.
Sorry for the trouble; if you would like to see this functionality implemented please vote on this improvement request:
https://forum.onshape.com/discussion/5763/mirror-feature-for-assembly-workflow
"24" is the name of my configuration but it keeps inserting the "Default"
As an example, I just created a simple part studio configuration with one input with valid values Smaller (originally with the name "Default") and Bigger. I call the get configuration API and it tells me that there is one configuration parameter:
Suppose I want what the user sees as Configuration=Smaller. I need to specify id values rather than name values to the configurationencodings API, so I will use parameterId="List_KAziYCON7D1YBU" and parameterValue="Default".
I can then call the configurationencodings API passing the body:
and it returns the response: