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.
Related
I'm using the Edit2D extension to draw a Polyline over the 2D model then the path of the polyline is sent to the designautomation API to draw the same polyline in the revit file.
The problem I'm having is that the designautomation is drawing the polyline correctly but the scale is incorrect, it doesn't match with what i'm seeing in the browser. The shape is fine, but the scale is not.
I assume that I need to customize the toolset to set the unithandler to use feet instead of inches. The documentation says to register a custom toolset this way:
edit2d.registerTools(MyToolSetName);
But there is no documentation on how to create the MyToolSetName toolset (i saw it's a complex object doing reverse engineering)
Any clue how can I set the unithandler and register it with the registerTools function?
Or any clue on how to make my 2D view in forge match the same coordinates as revit?
Thanks
Update (October 24th)
I built a sample on that, based on sheetviews translated from Revit files.
Please, refer here for more details.
It takes advantage of this blog.
As of now, it only works for sheetviews with viewports containing views that were also translated (present in the bubble generated).
Since we're drawing in 2D view, we only get X and Y from Viewer. Z components of the curves are defined at workitem by the plane used for drawing.
There's also a video on the sample here
Please refer here for details about using Edit2D Toolset (specifically under 3.2 Units for Areas and Lengths) as it says:
Edit 2D uses the same units and length calibration as the MeasureExtension. You can use MeasureExtension’s calibration panel to specify units and calibration for your Edit2D shapes.
We also have a sample that does a similar flow (without Edit2D) here
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/
For some of our Revit models, in Forge viewer, 2D views are display blurry, no element can be selected and the Measure extension does not work on elements and only works on the dimensions and the titleblock.
Like this example:
here and here
But it should be like this
I have tested it with our viewer, A360 viewer and Autodesk Forge Tools vscode extension.
This is because 2D drawings or PDFs can contain both vector graphics and raster graphics (this article explains the difference between the two). The measure extension needs vector graphics in order to work properly.
Thanks to Petr Broz and his hint, by changing the Model Display Style in Revit side to Hidden Line instead of Shaded the problem was solved.
Like this.
Update:
The Shadows in Graphic Display Options, also should be unchecked.
I need to see multiple .DWG in the Forge viewer in 3D format. There are some buttons on the viewer screen using which we can toggle between 2D and 3D views. On using those toggle buttons, currently we are able to see only one file at a time in the 3D view. Is there any option to view multiple files in 3D format?
You can use three ways to see multiple views of the same model.
Split the screen into multiple screens (SplitScreenExtension): https://forge.autodesk.com/en/docs/viewer/v7/reference/Extensions/SplitScreenExtension/
Place a view inside a div: https://github.com/Autodesk-Forge/viewer-navigation.sample/blob/master/www/scripts/model.js
Creating a div that renders a view within a DockingPanel.
I may have already answered this in your other Stackoverflow question, but, it is the same answer here. Try loading multiple models into a scene, using this blog post as your guide:
https://forge.autodesk.com/blog/loading-multiple-models-forge-viewer-v7
One neat trick with Forge Viewer, is the ability to load a 2D sheet inside the 3D world. The 2D sheet, if it comes from DWG, it will be vector lines, and if it's an old PDF, it will be image tiles.
Here's a video of combining 2D sheets into a 3D scene, into something more useful to your user...
Is there any HTML5/javascript/webgl viewer of KMZ KML 3D OBJECTS ?
i would like to use WEBGL technology to render kmz/kml 3d object (building) created in sketchup and uploaded to google warehouse.
Target is to use browser technologies instead of flash/java to render 3D product overview on white backgrdound with only horizontal rotation.
Thank you for any suggestions
Three.js has a ColladaLoader. SketchUp can export to Collada, and that's what KMZ files use. It's the .dae file in the KMZ.
I built a small library called kamikmz exactly for this purpose. The problem with loading a Collada model straight up is that you need to have the images referenced as textures available on the correct path as well. To overcome this issue I use the jszip library to unzip the kmz file right in the browser and the pass it to threejs.
Right now the library is still in development and has some performance issues when it comes to loading large models, however it works fine for most cases.