Determining ship's total weight

To determine the total weight of the ship, a JavaScript script can be used. The script calls the report generator, and sets some environment variables used by it. The report generator in turn uses a report layout to specify what is to be calculated.

The result of the calculation is copied to the opened block together with the generated log file.

Commands

In addition to the standard JavaScript functions supported by ECMA-262, the following CADMATIC Hull specific variables and commands are available. A global array holding the block names is also available.

In addition to the standard JavaScript functions, the following CADMATIC Hull specific commands are available.

Report layout

You can create a layout for generating a report with the total weight using the Production > Reports > Report Layout function in the System Management application. You can also copy the example below and save it as %NCGNORMS%\report\TotalWeightScript.rpt.

The example report layout is made for the example script presented below in Script example.

The layout contains only a summarized weight column. No sorting, sub summarizing or uniting is applied to the column. The header and footer are left empty.

The Total footer contains the keyword TWEIGHT for the total weight.

Script example

Below is an example of a script, TotalWeightScript.jsp, that opens the first 3D block available in the block list, then sets a number of environment settings needed by the report generator and executes it.

This script is meant to be used with the report layout presented above in Report layout.