CADViewer Technical Documentation, Installation Guide and Reference Samples Library

Menu Layout and Language Settings

CADViewer Version

CADViewer has two interfaces: Version 8 icons which uses scalable icons in SVG and legacy Version 6 icons which are based on bitmap icons at fixed size. Version 6 icons are light gray, whereas Version 8 icons are either black or deepblue.


The Icon, Navigation and Zoom menu visibiliy can be controlled with the following API commands:

A sample initialization to remove Zoom disk and Navigation menu, but retain the full Icon Command Menu would look like:

cvjs_displayZoomIconBar(false ,"floorPlan");  // disable standard zoom disk
cvjs_displayTopNavigationBar(false, "floorPlan");  // disable top navigation bar
cvjs_setTopMenuXML("floorPlan", "cadviewer_full_commands_01.xml", "cadviewer/app/cv/cv-pro/menu_config/");

A sample initialization to retain the Zoom disk , but remove Navigation menu and the full Icon Command Menu would look like:

cvjs_displayTopMenuIconBar(false, "floorPlan"); // disable top menu icon bar
cvjs_displayTopNavigationBar(false, "floorPlan"); // disable top navigation bar
cvjs_setTopMenuXML("floorPlan", "cadviewer_full_commands_01.xml", "cadviewer/app/cv/cv-pro/menu_config/");

Icon Menu Layout

Application programmers can control the menu interface through the menu settings. The menu system is built based on instructions in an XML file loaded from the API command: cvjs_setTopMenuXML().

The method cvjs_setTopMenuXML() takes arguments for the canvas element, the XML configuration file, and the location of the XML configuration file based on the CADViewer installation.

Standard initialization with all Icon Commands Active is:

cvjs_setTopMenuXML("floorPlan", "cadviewer_full_commands_01.xml", "/app/cv/cv-pro/menu_config/");

If loading from standard path settings, the last parameter can set to “”:

cvjs_setTopMenuXML("floorPlan", "cadviewer_full_commands_01.xml", "");

NOTE: If the name of the XML configuration file is different from “cadviewer_full_commands_01.xml” , the XML configuration file will be loaded from the CAD server back-end from the location: "/cadserver-location-on-server/cadviewer/app/cv/cv-pro/menu_config/" , unless modified through the 3rd parameter in the call to cvjs_setTopMenuXML().


XML Menu Structure

The XML configuration file sets up the Icon Interface of CADViewer. The user can completely control the layout of the Icon Inteface, the number of icons on each page, number of pages, and if the menu is aligned vertically or horizontally.


The XML configuration file contains:

  • Number of pages in the menu
  • Start-page at initialization
  • Commands on each page and their internal display order
  • Icons per row, if above 0, the icon menu will arrange vertically with a given number of icons per row
  • Icon Menu location
  • Tooltip text for Custom commands (placeholder for 10 custom commands)
  • Zoom disk location

Icon commands and their corresponding XML command name

The complete list over the Icon commands and their corresponding XML command name can be found in the Icon Command Interface:




Sample XML command menu

<cvjs>
    <iconmenu>
        <totalpages>4</totalpages>
        <startpage>1</startpage>
        <pages>
            <page>
            <command>cvjs_LayerList</command>
            <command>cvjs_Print</command>
            <!-- ... -->
            </page>
            <page>
            <command>cvjs_publishPDF</command>
            <command>cvjs_saveAsSVGOnServer</command>
            <!-- ... -->
            </page>
            <page>
            <command>cvjs_insertImageLink</command>
            <command>cvjs_loadAllImageLinks</command>
            <!-- ... -->
            </page>
            <page>
            <command>cvjs_changeSpaceObjectDisplayMode</command>
            <command>cvjs_addPolygonSpaceObject</command>
            <!-- ... -->
            </page>
        </pages>
        <icons_per_row>0</icons_per_row>
        <icon_page_left_x>0</icon_page_left_x>
        <icon_page_left_y>0</icon_page_left_y>
        <customcommand>
            <tooltip>Commmand tooltip 1</tooltip>
            <tooltip>Commmand tooltip 2</tooltip>
            <!-- ... -->
        </customcommand>
    </iconmenu>
    <zoommenu>
        <location_left_x>0</location_left_x>
        <location_left_y>30</location_left_y>
    </zoommenu>
</cvjs>

Download Samle XML Menu Files

Below is a few links to some of the XML files included in the CADViewer installation:



Language Settings

The method cvjs_loadCADViewerLanguage() sets the language at initialization. English is default, and the language can dynamically be modified from the settings menu.

The current languages includes: “English”, “French”, “Spanish”, “Portuguese”, “German”, “Indonesian”, “Chinese-Traditional”, Chinese-Simplified" and “Korean”.

cvjs_loadCADViewerLanguage("English");  // "English", "French", "Spanish", "Portuguese", "German", "Indonesian", "Chinese-Traditional", Chinese-Simplified", "Korean", 

See API documentation: cvjs_loadCADViewerLanguage() - required

Last updated on 24 Apr 2024
Published on 22 Mar 2020