Autodesk Forge Viewer - show markups all the time - autodesk-forge

We are using the Forge viewer to show both 2D and 3D models. For the 2D models, we would like to be able to show markups all the time, like you can with the viewer inside BIM360.
I tried the solution mentioned here: Forge Viewer: Show bottom toolbar and markups at the same time - but I have not been able to get that to work. It seems like when I call:
Autodesk.Viewing.Extensions.Markups.Core.Utils.showLmvToolsAndPanels(viewer)
It hides the markups.
How is this done in BIM360? - are they using a custom viewer, where this has been enabled somehow?

Unfortunately I was able to get it to work with:
Autodesk.Viewing.Extensions.Markups.Core.Utils.showLmvToolsAndPanels(viewer)
See live sample here:

Related

Forge Viewer add markups and choose elements in 2D drawings

We use forge viewer in our app. It's work good but, we want to add more functionality. But for now i can't get the element Id. I tried to use NOP_VIEWER.getSelection() but in our app return empty array. I also tried load our document here https://forge-extensions.autodesk.io/ and tried to do the same. In your example it works. Could you tell me where is the mistake?

Autodesk Forge Viewer don't automatically align the model to the center of the viewer

I have an IFC file, with the model component located quite far from the origin (Due to using the correct actual coordinates of the project). After uploaded and translated to Forge, the viewer does not display properly at the location where the model is located. While the url thumbnail still shows the model fit to view. I attach 2 image as follow. Please help how to fix this.
Thumbnail when translation finished:
[1]: https://i.stack.imgur.com/lQTLR.png
Viewer result:
[2]: https://i.stack.imgur.com/hiqS5.png
Forge is usually able to handle BIM models "far away from the origin" quite well. I'd try the following:
check if this isn't just some strange camera preset; when the model is loaded, try double-clicking somewhere on the empty space; this should transition the camera so that it's covering the bounding box of the entire model
alternatively, open the Model Browser panel, and select one of the nodes in the tree to move the camera to it
the Forge Model Derivative service allows you to switch between different loaders when processing an IFC file (go to https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST > "Attributes by Output Type" > "SVF Output", and search for conversionMethod in the advanced properties); give it a try and see if you get better results
And finally, if none of the above helps, consider sharing your IFC design with us (confidentially; we will not share the design with anyone outside of Autodesk) via forge (dot) help (at) autodesk (dot) com so that we could debug the issue on our end.

Forge Viewer: Search or Model Browser

How do I enable search on a 2D view in the forge viewer. Looks like the model browser is only available on 3D views. Is there a way to enable it on 2D views as well
Explicitly adding loading the ModelStructure extension does the trick.
viewer.loadExtension('Autodesk.ModelStructure')

How can i create 3d pushpin extension for autodesk forge?

I want to create 3d pushpin extension for Autodesk forge v7.*. I tried to use this article`
3D Markup with icons and Info-Card.
But some functions are not working correctly. How can i use it correctly?
I got this errors in console
Now all functions are working correctly, in data i got undefined for parent. Pushpins are not appeared yet.
Apparently there were a few issues with your code:
Since Viewer v7 and onwards overlay scenes are managed so you'd need to add custom geometry with:
this.viewer.overlays.addScene('custom-scene');
this.viewer.overlays.addMesh(this.line3d, 'custom-scene');
Use arrow functions or bind for your callbacks to window and document events such as mousemove or click otherwise they'd lose their contexts and throw errors
Necessary styling was not set for the markups to persist their relative positions ...
See here with corrections to all of the above:

Change Background color of 2D sheets of Autodesk Forge using Javascript

How to set a background color in 2D view of autodesk forge file to a specific Room on a floor or level using jquery
To set a background color in 2D, you have to two programmable options...
viewer.setBackgroundColor(...);
viewerImp.toggleSwapBlackAndWhite(true/false);
You can find the API details for setBackgroundColor here:
https://developer.autodesk.com/en/docs/viewer/v2/reference/javascript/viewer3d/
and line2191 toggle blackwhite here:
autodeskviewer.com/viewers/latest/docs/src_application_Viewer3D.js.html
Here is a working example...
Open this URL in a recent version of chrome:
https://autodeskviewer.com/viewers/latest/viewer3d.html?svf=https://lmv-models.s3.amazonaws.com/2d_model/primaryGraphics.f2d
Open up the debug console and type these two options:
NOP_VIEWER.impl.toggleSwapBlackAndWhite(true);
NOP_VIEWER.setBackgroundColor(255,255,0,0,255,255);
The result should give you a clue to what is possible with just the api.
This is specific to the web viewer. Is that what you were looking for ?