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.
- cvjs_setCADViewerInterfaceVersion(8) - default is Version 8 (version 7+), use this method and set to 6 for legacy Version 6 interface.
- cvjs_setIconImageSize(“floorPlan”,30, 40) - if in Version 8 -as the icons are scalable- the two icon menu sizes can be custom controlled through this API command, the default is 30px for small icons and 40px for large icons.
Menu Control Methods
The Icon, Navigation and Zoom menu visibiliy can be controlled with the following API commands:
- cvjs_displayZoomIconBar() -optional : Controls Zoom menu visibility
- cvjs_displayAllInterfaceControls() - optional : Controls removeval of all icon interface components
- cvjs_displayTopMenuIconBar() - optional : Controls top menu icon bar visibility
- cvjs_displayTopNavigationBar() - optional : Controls top menu navigation bar visibility
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:
- Standard Interface Commands
- Redlines and Sticky Notes
- Image Links
- Click Count
- Compare Drawings
- Space Object User 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:
- Full command interface: cadviewer_full_commands_01.xml.
- Icon Commands ordered vertically: cadviewer_verticalmeasurementbar_01.xml.
- Minimized single row containing zoom elements only: cadviewer_horizontal_zoomonly_01.xml.
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