Forge Viewer add markups and choose elements in 2D drawings - autodesk-forge

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?

Related

How to Display Icons on the Autodesk forge viewer without using an extension

I want to display some icons ( ex : exclamation mark ) on the viewer. My scenario is retrieving some data and display an icon on a particular object accordingly.
I could not find any documentation regarding this but found a sample code which uses an extension and then having icons as markups. Is there anyway to do a similar kind of operation without using an extension ??
Thank you!!
Please refer to sprites tutorial.
We`re also covering different options for labels in this series of blogs.

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:

Forge Viewer - can we associate objects of model with markups which are drawn in viewer?

I have object tree view on left side of my viewer, now am looking to establish an association with the markups drawn on the viewer, for example if click on wall object, it should focus me that particular wall object along with the markups there and also should hide other markups in that viewer. So it's making easy for user to see all those associated markups in that wall only.
Is this doable?
Thanks in advance
it should focus me that particular wall object along with the markups there and also should hide other markups in that viewer.
Try control the visibility of a markup with:
markupExt.markups[index].shape.style.display='none/block'
And to add markups to the position of a particular node follow here: https://forge.autodesk.com/blog/placing-custom-markup-dbid
This markup extension example should show you how to do, at least, part of what you are looking for:
https://github.com/apprentice3d/ForgeViewerExtensions

Autodesk Forge Viewer - show markups all the time

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:

How list the levels of a navisworks file in the viewer?

I'm trying to list the level of a building. I've load the Navisworks file and viewer is working.
Here is my page in javascript :
http://devsteel.fr/bi/
I've found an extension to color rooms and show a level. It load successfully but nothing appear on the viewer :
https://forge.autodesk.com/blog/make-shader-face-room-object-model
I've found this link to
https://forge-rcdb.autodesk.io/configurator?id=5a7185a92a0a7aeb152725d5
So, how to list the levels of my building like the examples?
EDIT : I've find the dbIdif of each levels. So, how can I only show One given level?
I've try viewer.show([12460]) but without success.
Maybe try Isolating it so only that DBID will be visible
viewer.isolate(12460)