Before I write about the sample itself, let me quickly note about the author and where the name of this sample “LmvDbg” is coming from. This application is written by Jim Awe, chief software architect at Autodesk. He is the original author of other tools which are well known in API communities: e.g., ArxDbg (for AutoCAD ObjectARX API), MgdDbg (for AutoCAD .NET API), and RvtDbg (for Revit, which later renamed as Revit Lookup). Dbg stands for Debug. Lmv stands for Large Model Viewer, which is the name used prior to officially named as View and Data API.
Now, let’s take a look at LmvDbg sample application. To start with, here is the link to the application in action:
Here is the link to the source code:
At the time of this writing, the page looks like below. Please note that this application is continuously updated as new functionality is added. If you are viewing with a small window, the layout may look different.
Warning: somebody seems to keep moving the location of those depository. If you find the link no longer exists, try to search “View and Data API” and “LmvDbg”.
Next, let’s take a look at the first one, Background Color, and see what it does. When you click on the any of link, it opens up the additional UI and the code that implements that functionality below the viewing area, e.g.,
Using this, you can play with the functionality while input different value in UI, and see how the code looks like to implement it. In order to debug, you use Chrome Developer Tool. You can put breakpoints to snoop into the code line by line.
As of this writing, following functionalities are included:
- background color – setBackgroundColor()
- navigation tool – get/setActiveNavigationTool(), getDefaultNavigationToolName().
- hide/show/visibility – areAllVisible(), hideAll, showAll, anyLayerHidden, getHiddennodes, getIsolatedNodes
- camera – .navigation.getCamera, applyCamera.
- View – navigation.setView, fitToView, navigation.setWorldUpVector, setViewFromFile, setViewFromViewBox.
- focal length – get/setFocallength,
- FOV – get/setFOV, navigation.getFovMin/Max
- Explode – getExplodeScale, viewer.model.is2d, explode.
- viewer state – getState, restoreState,
- screen shot – getScreenShot,
- search – search, isolate, getProperties,
- object tree – getObjectTree, isolate, hide, show, fitToView, getProperties
- mouse-click config – getClickConfig
Other methods (these includes combination of number of functions. Not exhaustive list)
- Viewer preferences – displayViewCube, setUsePivotAlways, setZoomTowardsPivot, setClickToSetCOI, loadExtension, unloadExtension, SetReverseZoomDirection, setOrbitPastWorldPoles, setPropertiesOnSelect, setUseLeftHandInput, etc.
- Viewer settings – anyLayerHidden, areAllVisible, canChangeScreenMode, etc.
- Selection set – getSelection, getSelectionVisibility, getSelectionCount,
- Navigation settings – navigation.getCamera, getCameraUpVector, getFovMax/Min, etc.
- Document settings — _loadedDodument.getPath, getPropertyDbPath, getRootItem, getViewablePath, getThumnailPath, getNumViews,
- Model settings — _viewer.model, model.geomPolyCount, getBoundingBox, getData, getLayerRoot, getRoot, getRootId, getUnitScale, getUnitString, getUpVector, instancePolyCount, is2d, isLoadDone, isObjectTreeCreated.
- Override color — _viewer.impl.createOverlayScene, imple.removeOverLay, impl.addOverlay, impl.getRenderProxy.
- Toolbars – getToolbar, Viewing.UI.ControleGroup, Viewing.UI.Button, addControl, etc.
Here is a snapshot of another example showing how the object tree functionality looks like:
I hope this quick introduction is enough to motivate you to take a look at LmvDbg sample, and encourage you to explore and learn what is possible using View and Data API.
Update: 2/8/2017. Updated to new URL’s for demo and github location. Looks like somebody keeps moving around 🙂