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.

Using Create Translation api call

KinKin Member Posts: 8 PRO

I am planning to use “create translation” api to convert assembly to part. Have following queries on using this api in app.

  1. Can we use url “/api/blobelements/d/***/w/***/e/***/translations” in app(java in spring framework) for the translation?
  2. In the following request through api explorer, result is stored in the same document. Please let me know what changes needed in “request body” to store output in different Onshape document.
  3. If possible, Please share an use case for this api.

    API call request & response through api explorer. 
    Request body: 
    {
      "formatName": "ONSHAPE",
      "versionString": "",
      "notifyUser": "true",
      "flattenAssemblies": "true",
      "yAxisIsUp": "false",
      "importInBackground": "true",
      "allowFaultyParts": "true",
      "createComposite": "false",
      "storeInDocument": "true",
      "linkDocumentWorkspaceId": ""
    }

    Response body:
    {
      "requestState" : "ACTIVE",
      "resultExternalDataIds" : null,
      "requestElementId" : "deba8204f978e51778b706f9",
      "resultElementIds" : null,
      "resultDocumentId" : "75dc856924b5ee48d89cc600",
      "failureReason" : null,
      "workspaceId" : "80bb0676cf2e5dc5cb02d264",
      "documentId" : "75dc856924b5ee48d89cc600",
      "versionId" : null,
      "resultWorkspaceId" : "80bb0676cf2e5dc5cb02d264",
      "href" : "***",
      "id" : "5e30034392a56915a4270c2d",
      "name" : "***"
    }

Comments

  • ethan_keller924ethan_keller924 Member Posts: 38 ✭✭
    Hi Kin, 

    1. Almost, that is the correct endpoint to use if you are trying to get some translation from a blob element. However, if your goal is to grab a translation from an assembly, you'll need to use the assembly create Translation endpoint here: /assemblies/d/:did/[wv]/:wv/e/:eid/translations

    2.  Not sure I understand this question... There is a storeInDocument flag to indicate whether or not to save the translation result in the document. If you set this to false, the translation won't get stored in the document, and you'll be able to download the resultant translation using the url provided in the response. However, there is no way, using only the one API call, that you can save the result to another document. To do that, you'll have to download the translation and then upload it to the target document. Let me know if I misunderstood this question!

    3. Working on this. I'll post here with an update soon.

    Cheers,
    -Ethan
  • KinKin Member Posts: 8 PRO
    Hi Ethan,
    Thanks for the reply. 

    Please find my comments below.
    1. At first place,i tried using assembly translation but the results are not satisfying my requirements. As shown below, it creates multiple documents with ONSHAPE format & STEP format is also not helpful for me. Please suggest alternate format if any.

    Request:
    {
      "formatName": "ONSHAPE",
      "includeExportIds": "true",
      "storeInDocument": "true",
      "linkDocumentWorkspaceId": ""
    }
    Response:
    {
      "requestState" : "DONE",
      "resultExternalDataIds" : null,
      "requestElementId" : "35e18e26b314d7270ce7ca09",
      "versionId" : null,
      "workspaceId" : "75d2a28540122a80c4ff2a36",
      "documentId" : "3e8d858005377530739b9f46",
      "resultElementIds" : [ "d724d6c9feb4352a6c79b1b0", "b2cb721fcdb3b2f28b0c7bf9", "dd0109b384ddc628f6d67e07" ],
      "resultDocumentId" : "3e8d858005377530739b9f46",
      "failureReason" : null,
      "resultWorkspaceId" : "75d2a28540122a80c4ff2a36",
      "id" : "5e49f314be6ae5160e9391d2",
      "href" : "https://garrettmotion.onshape.com/api/translations/5e49f314be6ae5160e9391d2",
      "name" : "856378-0006"
    }

    2. To re-iterate, my requirement is to convert an onshape assembly(which is not in current document) to solids(position same as in assembly) & store the result as one(new) part studio to the current document. Current document is the one from where i am running the app. 

    3. Thanks again :smile:
  • ethan_keller924ethan_keller924 Member Posts: 38 ✭✭
    Hi Kin,

    I want to make sure I understand... your goal is to translate an Onshape assembly to STEP, for instance, and then to do some work on that STEP file in a PartStudio? To do that and specify that you want to keep all the parts within one document, you will probably have to download then upload. That will give you control over the translation step. Unfortunately there is no way to do this directly. Please also note that you will be losing a lot of information. Every patterned part will appear as separate parts, all the mate information will be lost, and you could see huge performance costs from large patterns.

    Our goal, in general, is to avoid this workflow since it leads to inaccurate BOMs, and bad performance - so proceed with caution. This is why we've gone to great lengths to make in-context editing so that geometric info from the assembly can be consumed in the PS. 

    Hope that helps!
  • KinKin Member Posts: 8 PRO


    You are right, assembly translation loose lot of information & cant afford it.  "Create translation" api is doing exactly what i need(as shown in image above) except the result storage. As mentioned in my previous comment(item 1), need is to store the result in different document where user runs the application.
    If you are ok, we can have a quick call through skype(please contact Kevin O toole for details). Please let me know.
  • ethan_keller924ethan_keller924 Member Posts: 38 ✭✭
    Hi Kin,

    Yes, this is possible, it will just require two API calls, as it does even when you perform these actions through the UI. The first to translate the API into probably a parasolid format (that will lose the least information) and then to upload into the document. There is no way to do this currently without creating a translation of the assembly into some format, and then uploading. I'm not sure I understand "assembly translation loose lot of information & cant afford it." - translation is the only way to accomplish this. 

    Does that make sense? I'll chat with Kevin.
  • KinKin Member Posts: 8 PRO
    Thanks. Let's have a quick call if ok.
Sign In or Register to comment.