Dawe
Dawe

Reputation: 610

Autodesk Forge Viewer how to get a screenshot of the part of a model

I have for example 20 element Ids and I want to make screenshot of them (like a detail). For that screenshot I would like to have specific dimensions (for example 400x400). My current viewer has different dimensions. Is there some way how to achieve it and return current viewer in original view?

I was trying to do these steps:

  1. store current view
  2. set viewer dimensions
  3. do fitToView(elementIds) - I have tried to manipulate camera, but I am not much familiar with it. Also, I have tried to use fitToView but passed elements are sometimes out of the view.
  4. getScreenshot(400, 400)
  5. restore view

struggling with it so any help would be great

Upvotes: 0

Views: 437

Answers (1)

Petr Broz
Petr Broz

Reputation: 9942

There's a nice blog post providing more details around the dimensions of screenshots taken from Forge Viewer: https://forge.autodesk.com/blog/more-screenshots.

If that does not help with your use cases, you could also consider having an additional instance of the viewer on your page, sized exactly as the screenshots you'd like to generate, and only load the IDs of elements you need. Here's a simple code that demonstrates the idea: https://github.com/petrbroz/forge-basic-app/commit/f95cb67944830b842955c9599f2e1e4683ff13f0.

Upvotes: 1

Related Questions