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

Solutions for Batch Exporting

Kyle_DupreeKyle_Dupree Member Posts: 2 PRO
Hi all,

I'm trying to find a method for batch exporting drawings into PDFs and sheet metal parts into DXFs from OnShape, when you have large released assemblies with parts and drawings in multiple documents, and potentially multiple configurations.  Whether this be a 3rd party program, OnShape app, or something native.

Currently I have to create a large release package and export the PDFs one-by-one from that release package, Onshape did recently add a feature to batch export drawings from the tab manager; however, when you do that it cannot use your naming scheme correctly.  I have to choose whether to rename 100+ PDFs by hand in File Explorer (and potentially make a mistake) or export them one by one from the release package.

It's the same issue with DXFs except these have to be done at the part studio level grabbing the sheet metal model.

It's just an exceedingly manual process that takes hours and it allows for a lot of mistakes to be made during the process.

I'm wondering what everyone else uses as a solution to this, if there's a 3rd party program or software that people have found success with or just a different method.

Answers

  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,769 PRO
    @caden_armstrong Do you know if this already exists or if it is possible to do this with API?

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Options
    caden_armstrong2caden_armstrong2 Member, User Group Leader Posts: 127 ✭✭✭
    Hi Kyle,

    We talked about this back in January, and at the time exporting a sheet metal DXF via the Onshape API wasn't supported.
    But I just tested it again, and it looks like it is now supported!

    I'll send you another email to follow up.


    For any future readers, it can be done via the endpoint:
    https://cad.onshape.com/glassworks/explorer/#/Document/export2Json
  • Options
    chadstoltzfuschadstoltzfus Member, Developers, csevp Posts: 135 PRO
    It is absolutely possible with the API, we have done this ourselves for drawings (before the batch export from Onshape was created). What we do is we export the drawing as a PDF (you could also export it in other formats like DXF), store the PDF in the Onshape document, put the newly created PDF in a ZIP file, download the ZIP file, then delete all of the PDFs that were created by that batch export. 
    Applications Developer at Premier Custom Built
    chadstoltzfus@premiercb.com
  • Options
    sunny_dabgarsunny_dabgar Member Posts: 4
    It is absolutely possible with the API, we have done this ourselves for drawings (before the batch export from Onshape was created). What we do is we export the drawing as a PDF (you could also export it in other formats like DXF), store the PDF in the Onshape document, put the newly created PDF in a ZIP file, download the ZIP file, then delete all of the PDFs that were created by that batch export. 
    Hello,
    Can you please provide the API
    how you can download the PDF of drawings.
  • Options
    chadstoltzfuschadstoltzfus Member, Developers, csevp Posts: 135 PRO
    We used to do this using Onshape's API but no longer do this as batch exporting of files is now possible using the tab manager in Onshape. Simply select all of the drawings you want to export, right click, then select "Export __ drawings" and follow the on screen prompts. 

    If you are wanting to do this with the API, you'll want to use the translations endpoint. With this, you can create a drawing translation inside of the document the drawing resides in. Make sure you set the formatName in the request body to "PDF." 

    From there, you'll want to use the blobElements endpoint. This will give you a JSON response with PDF. You may need to use some encoding depending on what type of application you are calling this endpoint with.

    Here are some more examples of translation provided by Onshape. 
    Applications Developer at Premier Custom Built
    chadstoltzfus@premiercb.com
  • Options
    shawn_crockershawn_crocker Member, OS Professional Posts: 834 PRO
    I use the API.  I use retool for interacting with the API.  Retool is pretty great to quickly create custom workflows for onshape as long as you know simple JavaScript or are willing to spend a few hours learning some.
  • Options
    Jascha_WilcoxJascha_Wilcox Member Posts: 3 PRO
    Just saw this thread as we are writing some tooling to automate batch exporting things using the API.

    I also posted a tool recently to directly pull DXF geometry out of STEP assemblies. Maybe it would be good to write a version that directly exports plates given an onshape document url? https://github.com/jaschawilcox/step2dxf
Sign In or Register to comment.