Using LeafletLoader instead of PDFLoader to load a PDF into the forge viewer is not working - autodesk-forge

I want to load a large image into the forge viewer. I embedded the image in a pdf. However, when loading the pdf the vector pdf's resolution is not high enough and visibly worse than in the original pdf. Threfore, I am trying to load it via the LeafletLoader as described in this blogpost. However, setting LMV_RASTER_PDF did not switch to the LeafletLoader (LMV_VECTOR_PDF is set to false). The loader used is still the PDFLoader.
Is there a setting I am missing or is there a way to load a leaflet map directly with the forge viewer? (LMV 7.40.0)

The PDF file needs to be translated to SVF - that's going to generate the leaflets.
https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/prep-file4viewer/task3-translate-source-file/

Related

How to export markups created for Inventor (drawing/part/assembly) file to PDF from viewer

We have created a markup extension in the autodesk viewer. Is it possible to export a markup to PDF using APIs.
The online viewer from Autodesk has Print button which looks to be calling window.print(). Is this the way to print the drawing to PDF?
In the viewer from "Comments" I open a specific markup and ("view markup" window) click "Print" and it prints drawing without markups.
The button "Export" under "Comments" is exporting all the markups into a single PDF file. How do we do this using forge APIs.
Is it possible to print only selected a markup instead of all the markups.?
Thank You for your help.
There is no official/supported way of doing this using the Viewer APIs but you might be able to get markups "baked" into a PDF by combining multiple features/libraries:
the Markups extension in Forge Viewer allows you to render the markups into a PNG file; see this Stack Overflow answer: Autodesk Forge get screenshot with markups
there are 3rd party libraries that allow you to insert semi-transparent PNG images into PDFs, for example pdfkit: https://pdfkit.org/docs/images.html
since the Markups extension uses an <svg> element under the hood, you should also be able to hide any of the SVG elements you don't want included in the PNG

Is Gltf2 Animation supported in Forge Viewer?

I've got a Gltf2 model which contains an animation (I checked on sandbox.babylonjs.com and I see the animation, so the gltf is ok). Is it possible to view the animation on the Viewer? I translated to SVF2 and loaded the model, but there is nothing referred to the animation...
Is there something more I should include in the translation or some option to use when creating the viewer?
Thanks for your help
glTF animations are not supported, no matter whether you're loading the glTF file into the viewer directly (https://forge.autodesk.com/blog/gltf-20-support-forge-viewer), or converting it to SVF or SVF2 first, as there hasn't been a demand for this feature.
As a potential workaround, you could try loading the glTF file using the standard three.js loader (which I'm guessing does support animations?) and place it inside a viewer overlay.

Design automation v3: pdf Plot doesn't display pdf & image attached

I'm trying to plot a dwg with pdf & images attached to it.
Dwgs export well, but images and pdfs attached to it are not visible.
I'm using a custom activity with the PlotEngine.
Is it a problem on the forge side? Or is it possible to fix this bug directly in the AppPackage
Can you check whether you have supplied the image file that you attached into the drawing as an input argument? If your input argument only specifies the host drawing file, then the Design Automation does not know where the image is and it will treat it as an unresolved reference. In this case, the image won't be plotted into the PDF.

How do I get a consistent markup font size across models when using the Autodesk Forge Viewer MarkupsCore extension?

I'm using the MarkupsCore extension to make persistent text markups on a bunch of different 2D models. I'm setting the style like this:
markupsExt.setStyle({"font-size" : .12});
Usually this works. But sometimes, depending on the .dwg file that gets uploaded to Forge, the markups are way too small. I have no control over the files that get uploaded and I have no idea how they are configured when they are created in AutoCad.
What's going on here and how can I achieve a consistent font size in my markups no matter what model I'm marking up?

Extract vector images from Revit file

I was wondering if it's possible to extract Vector images from 2d views of revit files from forge api. I've used the following endpoint to achieve thumbnail of the views, but the thumbnails are very small (400 x 400)
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-thumbnail-GET/
Is there a way I can extract high resolution image, (preferably in vector formate that can be zoomed in or out) from a 2d View ?
Here's an example that I've tried:
https://jsfiddle.net/uLnvwyLa/
Use the Viewer screenshot API and run a headless browser, no UI interaction needed and can run server-side. This will definitely produce the highest quality thumbnails that you can possibly obtain. Here are links that may be helpful:
https://github.com/GoogleChrome/puppeteer
http://adndevblog.typepad.com/cloud_and_mobile/2015/05/screenshot-extension-manager-for-the-viewer.html
See viewer.getScreenshot method:
this.viewer.getScreenShot(
width, height, (blob) => {
Talked with Autodesk support Philippe
For the 2d views in Revit, the short answer is that Forge does not support translating 2d views to vector images or high resolution images as you wanted.
But here is some additional information in case this is also workable for you. You can use Model Derivative API to translate the 2d views into f2d format, just make sure to set the output.formats.views to both "2d" and "3d". You can not open this f2d file directly, but only through the Viewer3D library to load it into browser just as same as svf file, check the doc and tutorials here, the result looks as follow, and you can use http://lmv.ninja.autodesk.com to play with a 2d sheet and see how it works in browser.