How to invoke the default tool function of forge?

after using viewer = new Autodesk.Viewing.Viewer3D (myViewerDiv, config3d), there are no tools on the entire interface, not even viewcube. Now I want to make a layout on this quick interface, such as adding some div, and the location is on the right, so how can I call some functions that come with viewer? For example, if I want to add the roaming function to the custom div, how can I invoke the roaming function that comes with it? For example, if I want to display viewcube, somewhere, how can I call this function?

clipboard.png

Mar.04,2021

you need to use Autodesk.Viewing.Private.GuiViewer3D to create Viewer default toolbars and ViewCube to appear, or in the context of Autodesk.Viewing.Viewer3D , create ViewCube and Toolbar

by using the following code
// ViewCube
const viewCubeUi = new Autodesk.Viewing.Private.ViewCubeUi( viewer );
viewer.viewCubeUi = viewCubeUi;

viewCubeUi.create();

// Toolbar
const toolbar = new Autodesk.Viewing.UI.ToolBar( 'my-awesome-toolbar' );
viewer.toolbar = toolbar;

// Button
var button1 = new Autodesk.Viewing.UI.Button( 'my-orbit-button' );
button1.onClick = function(e) {
    var state = button1.getState();
    if( state === Autodesk.Viewing.UI.Button.State.INACTIVE ) {
        viewer.setActiveNavigationTool( 'orbit' );
        button1.setState(Autodesk.Viewing.UI.Button.State.ACTIVE);
    } else if( state === Autodesk.Viewing.UI.Button.State.ACTIVE ) {
        viewer.setActiveNavigationTool();
        button1.setState( Autodesk.Viewing.UI.Button.State.INACTIVE );
    }
};
button1.addClass( 'my-orbit-button' );
button1.setToolTip( 'Orbit' );

// SubToolbar
const subToolbar = new Autodesk.Viewing.UI.ControlGroup( 'my-custom-view-toolbar' );
subToolbar.addControl( button1 );

toolbar.addControl( subToolbar );

only a few default tools are loaded through extensions, such as Autodesk.Section , Autodesk.FirstPerson , Autodesk.BimWalk , most of which are written in GuiViewer3D code, please go to viewer3d.js to find GuiViewer3D-sharpcreateUI () implementation ideas.

reference:

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9f2cb-1a33.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9f2cb-1a33.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?