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.

Getting thumbnails and shaded views through API problem

shawn_crockershawn_crocker Member, OS Professional Posts: 798 PRO
I am able to call a shaded view for a document successfully.  Problem is, depending on what item is being referenced, it may not be fitting into the image border and is just getting chopped off.  Is there some way to change that behavior that I am not seeing in the Doc's?  Another problem.  I have tried getting thumbnails but thumbnail does not exist gets returned.  I have also tried posting to create a thumbnail for the item but also am getting an error "Could not get element information".  Anyone know what maybe wrong here.  I am testing this using glassworks.  The same id's have been working fine when testing out other end points.
Tagged:

Best Answer

  • caden_armstrongcaden_armstrong Member, User Group Leader Posts: 127 ✭✭✭
    Answer ✓
    Could you provide samples of your API calls?
    How are you setting the view matrix for shaded views?

    How are you trying to get the thumbnail?
    If you call the basic /api/thumbnails/d/{did} you should see a list of valid thumbnail hrefs.
    If you call a size that doesn't exist, you'll get an error.

Answers

  • caden_armstrongcaden_armstrong Member, User Group Leader Posts: 127 ✭✭✭
    Answer ✓
    Could you provide samples of your API calls?
    How are you setting the view matrix for shaded views?

    How are you trying to get the thumbnail?
    If you call the basic /api/thumbnails/d/{did} you should see a list of valid thumbnail hrefs.
    If you call a size that doesn't exist, you'll get an error.
  • shawn_crockershawn_crocker Member, OS Professional Posts: 798 PRO
    Thanks again @caden_armstrong.  Stupid me though I could type any size I wanted into the sz parameter.  After your comment I realized there was a reason the thumbnail data that comes in with a metadata call is an array of the available options.  Do you know by chance why the available size options are not always the same for any item and why the array of options seems to always be in a different order for different items?  I can't just reference a particular array index to use because the size I want changes array index positions.  For now as a workaround, I am going to attempt doing a .find() or something to pull out the data explicitly.
  • caden_armstrongcaden_armstrong Member, User Group Leader Posts: 127 ✭✭✭
    I don't know for sure why the array is in a random order.
    My guess would be that they get added in the order that they are created, and thumbnails are only made as they are needed.

    You'll probably have to check the list by the size parameter for what you want, but then if it doesn't exist, do the post command to make the thumbnail exist.
    You likely won't be able to guarantee that the size you want exists.
  • shawn_crockershawn_crocker Member, OS Professional Posts: 798 PRO
    @caden_armstrong
    Thanks.  I have managed to script a little transform to always pull out the size I want from the array regardless of its index in the array.
Sign In or Register to comment.