forge Viewer - cant below markups be rotated? - autodesk-forge

I was checking example https://forge-rcdb.autodesk.io/configurator?id=598d7ec14cabf2c1f4dec948
Not sure while I see markups in View state, the model cannot be rotated? Is this by design? Or markups drawn using different shapes cannot be viewed using camera events? If this is possible, show me an example which shows this.
I exactly need similar example where I can have an editor where markups mode can be selected and draw?

It is by design but you can try below to enable navigation when in view mode:
Autodesk.Viewing.Extensions.Markups.Core.Utils.showLmvToolsAndPanels(viewer)
markExt.allowNavigation(true)
viewer.navTools.orbittoolsbutton.container.style.display='block'
// then pick the desired tool from toolbar and navigate
Note this is NOT officially supported (since navigation is suppressed by design) and might not work with future releases (works as of 7.12).

You might be interested by this example for 3d markup using the Forge Viewer even though it doesn't have a configuration mode.
https://github.com/apprentice3d/ForgeViewerExtensions

Related

How to show dwg in web page

I have a dwg (I can change the file format to svg or other formats if needed) file that I want to show on my web page. After this file is displayed in the page, I want to be able to zoom in, zoom out, pan and put links that request the api where necessary. In fact, it looks like information and links about the relevant place appear when you hover over the landmarks on Google maps.
How should I go about doing this job?
If you can translate the DWG file to DXF (there are several tools to do this) then you can use MapServer to render it on a web map compatible way. Have a look at MS4W for an easy way to install and configure MapServer on Windows. Since you want pop-ups, I'd recommend using Leaflet as the client side browser tool kit for providing pan, zoom, pop-ups etc to communicate to MapServer. figuring out the coordinate system of the DWG file will likely be the hardest part.
Use this method if integrating your DWG with other mapping data (roads, etc) is important. Otherwise look for something easier to implement.
There are libraries that let you easily zoom and pan an SVG image. For example svg-pan-zoom.
As for the links, you would need to do a bit of extra work. IIRC DXF files don't have the concept of a whole element that you could hover over. All the lines in the file are discrete object. So, if I am remembering that correctly, you may need to load the SVG into an editor and add elements on top of the diagram that correspond to your hover areas. They don't need to be visible. They can be transparent and still hoverable. You just need to then add the interactivity. Ie.
Optionally add hover effects with CSS.
Add a mouseover or click event handling to implement the link handling, or
use standard SVG <a> linking instead.

Forge Viewer 7.X : Make vertex visible on mobile

I need to show the edges of the geometries on mobile using the Forge Viewer 7.X but since version 6.X edges are hidden to improve mobile performance.
https://forge.autodesk.com/en/docs/viewer/v7/change_history/changelog_v6/
Vertex array objects default to false on mobile devices to save memory
It's there a way to turn them on again?
PS: The same log shows a render setting renderEnvironmentDisplayEdges but I can't find where it should be set.
[Edit] To comply with #Peter O. comment:
It is possible to create an override to a Three.js implementation to show meshes edges after the geometry is already loaded/created?
The solution I found have to be made while loading the geometry but the process is being taken care by the Forge Viewer so I'm not sure if I can apply it.
https://threejs.org/docs/#api/en/geometries/EdgesGeometry
Maybe this would help:
viewer.setDisplayEdges(true);

Forge viewer displays elements blurry in 2D views and the Measure extension does not work on them

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.

Plan from Revit becomes a picture in forge viewer

So when I export my Revit file to the Forge Viewer the 2D plan I want to look at does not have any selectable elements because it somehow was exported as a picture.
It is only my assumption that it was exported as a picture since it becomes blurry when I zoom in. Is this a known issue or does my plan need a special property to be able to be translated to forge properly?
Using a demo file everything works perfectly but using a file coming from a different source does not seem to work properly
There are a few reasons for a view to becoming a raster:
uses shading, shadows, gradients, or sketchy lines.
is rendered.
contains an image.
uses point clouds.
contains a decal. (Includes Revit Annotation elements, such as section, spot, text, and etc.)

Autodesk Forge - Initial focus on 3d view

our initial focus within our 3d views needs tweaking. Currently it is zoomed out ~x2 too far.
Can anyone get me started in the right direction for the controls for this?
I've tried changing the cropregion/ section box etc in the original revit model, but that hasn't made a difference.
A simple way to handle that would be to position the camera as you wish then save the current state and restore it upon loading the model, see my blog post about managing viewer states: Managing viewer states from the API