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.

Options

Using Transform Assembly Occurrences API Call

matthew_mueller295matthew_mueller295 Member Posts: 6 EDU
Hello,

I want to be able to move parts around in an assembly with an API Post, and believe the "Transform Assembly Occurrences" call will do that, but can't figure out the JSON syntax. I'm taking the occurrence string from the "Assembly Definition" Get request. Here is one of the request bodies I've tried:

{
  "occurrences": "{ "path" : [ "M+71F+lRPMmz6IrdH" ], "transform" : [ 0.0, 1.0, 0.0, -0.01222426182365419, -1.0, 0.0, 0.0, 7.397456422448163E-4, 0.0, 0.0, 1.0, 0.026334691189542413, 0.0, 0.0, 0.0, 1.0 ], "fixed" : false, "hidden" : false }",
  "occurrences.0": "{ "path" : [ "M+71F+lRPMmz6IrdH" ], "transform" : [ 0.0, 1.0, 0.0, -0.01222426182365419, -1.0, 0.0, 0.0, 7.397456422448163E-4, 0.0, 0.0, 1.0, 0.026334691189542413, 0.0, 0.0, 0.0, 1.0 ], "fixed" : false, "hidden" : false }",
  "occurrences.0.path": "M+71F+lRPMmz6IrdH",
  "transform": "[ 0.0, 1.0, 0.0, -0.01222426182365419, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.026334691189542413, 0.0, 0.0, 0.0, 1.0 ]",
  "isRelative": "False"
}

Thanks,
Matt

Comments

  • Options
    francesco_norifrancesco_nori Member Posts: 4
    edited August 2021
    I have changed your body with the following and it worked:
    {
      "occurrences": [{ "path" : [ "M+71F+lRPMmz6IrdH" ]}],
      "transform": [ 0.0, 1.0, 0.0, -0.01222426182365419, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.026334691189542413, 0.0, 0.0, 0.0, 1.0 ],
      "isRelative": true
    }
Sign In or Register to comment.