Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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_holjesconnor_holjes Member Posts: 9
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...

Best Answers

Answers

  • connor_holjesconnor_holjes Member Posts: 9
    Made some progress, was able to get the partId inserted into the assembly, looks like at the origin. If I try and do a translation though I get this error:
    {
        "moreInfoUrl": "",
        "message": "Provided transform matrix is not a rigid rotation.",
        "status": 400,
        "code": 9999
    }
  • connor_holjesconnor_holjes Member Posts: 9
    Okay more progress... so I am using the 4x4 translation matrix but I get the same error as before if I try and do a reflection...?
       "transform": [
          -1,0,0,0,
          0,1,0,0,
          0,0,1,0,
          0,0,0,1
       ]
  • connor_holjesconnor_holjes Member Posts: 9
    Okay! Another question. How Can I specify the configuration. Does not seem to be changing the part?
  • connor_holjesconnor_holjes Member Posts: 9
    {
       "transformGroups": [{
       "transform": [0, -1, 0, 2, 1, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 1],
       "instances": [{
          "partId": "XXX",
          "configuration": "24",
          "documentId": "asdjsdu0a9doasnasdasdas",
          "elementId": "aasoidua332asdsdasda"
       }]
    }],
    "microversionId": ""
    }

    "24" is the name of my configuration but it keeps inserting the "Default"
  • connor_holjesconnor_holjes Member Posts: 9
    Very helpful thank you! Just to clarify, is the configurationencodings API 'encoding' anything or is it just concatenating the parmaId and the paramVal? Just want to avoid making another request if that is all that is happening.
  • mark_noyesmark_noyes Member, Onshape Employees, Developers Posts: 21
    In many cases it is simple and you could easily form the configuration string yourself, as you suspect. With multiple inputs the inputs also need a ';' separator. Things get trickier if the values contain any non-alpha-numeric characters and there is some additional encoding that gets done. Therefore, we do recommend that you use the API to avoid surprises.
Sign In or Register to comment.