translation including all pages in a drawing from API

shawn_crocker
shawn_crocker Member, OS Professional Posts: 1,069 PRO
For the time being, I need to use an image format when doing my drawing translation through the api.  I am noticing that only the first sheet is being translated.  This makes sense being an image file.  I am not able to figure out how to create a translation of the other pages.  I'm thinking there must be a way to loop through the available sheets and create a translation for each one?  I see the parameter sheetIndices[] and I am not sure if that is what I need to use some how.  I also do not know how to query the drawing to see how many sheets it contains.  This doesn't seem to be included in a metadata call.

Answers

  • sjalife
    sjalife Member, Developers Posts: 26 PRO
    Did you get this figured out?

  • shawn_crocker
    shawn_crocker Member, OS Professional Posts: 1,069 PRO
    @sjalife
    I did.  Thanks for asking.  It was clarified to me that we cannot translate all the sheets when using an image format translation.  So, I have just switched to using the .pdf option.  We have an app that creates a MFG package of all the info needed to build a certain product.  The app sends everything to a template api to generate a printable report.  I need to send the drawings as images for them to be added into the report.  I have just implemented another file conversion api that converts the .pdf sheets to individual .png images and then I use those in the template api.  I actually like it better because we then get to file away a proper .pdf drawing which is nice when needed to access the drawing on the fly without having to wait for the onshape doc to load.  I am using convertAPI for this file conversion.  It works very good and returns an array of the sheet images in .base64 which I then upload into our file system along with the base64 pdf.  If I restarted, I would probably use cloudConvert.  I think it is a little cheaper and it looks like you can connect it directly to your file system and have the conversion directly dropped in.