Running scripts with Hull Clone

Hull Clone is a command line utility that allows standalone batch processing in a CADMATIC Hull project. You can use JavaScript with the Hull Clone feature to execute heavy operations such as updating or recalculating all blocks, updating hull shapes and changes of reference planes, and preparing blocks for CADMATIC Outfitting. This can be done with any machine that has access to project data.

The Hull Server can be put in a Models only mode for faster generation of 3D models. In this mode, not all logistical data is being calculated, it is only meant for generating missing 3D models. This mode can only be enabled from Hull Clone ( executeInHullServer("models_only on")).

Hull Clone uses the MuJS JavaScript interpreter to parse the JavaScript code. MuJS implements ECMAScript specification ECMA-262. Any JavaScript code supported by ECMA-262 can be used in the Hull Clone scripts. For information about the MuJS JavaScript interpreter, visit https://mujs.com.

Important: The Hull Clone feature requires a Hull Structure license to be present, but the license will not be used. Also the license server name must be defined. Hull Clone reads the license server host name from the %DM_NLC_HOST% environment variable. If this value is not available, Hull Clone will not run. The license server host name can be defined when installing CADMATIC Hull, as License Server on the License page of the Setup Wizard.

Running scripts

To use Hull Clone you run the hullclone.exe executable file from the Windows Command Prompt window. The hullclone.exe file is by default located in the %ncgbin% folder (C:\cadmatic\<project folder>\nupashull\windowsNT\ncgbin\).

When running hullclone.exe, you must first define the path to the target project and then enter the commands. Optionally you can specify a JavaScript file to be run. Paths to the target project and the JavaScript file can be absolute or relative (relative to the folder where Hull Clone is run from). In a COS (distributed) project Hull Clone works inside the Hull subfolder of the project folder <project>.pms. However, only the project folder needs to be specified in the command line. Hull Clone will automatically add the subfolder.

  1. At start-up, hullclone.exe accesses the project specified in the command line, sets the required environment variables, starts a hull server, and either a NAPA or HDB shape database.

  2. Once this initialization is done, the code contained in the JavaScript file specified in the command line is executed.

Syntax

{hullclone} {/c dde|tcp_ip} {/debug} {Hull project} {JavaScript} {--|/jsArgs js_arg_1 js_arg2 .... js_argn}

Where:

  • {hullclone} is the path to the CADMATIC Hull installation folder including the path \nupashull\windowsNT\ncgbin\hullclone.

  • {/c dde|tcp_ip} – the option /c is used to enable TCP/IP communication or to explicitly enable DDE communication. If not given, the default communication method is DDE.

  • {/debug} is the option to output also the debug messages.

  • {Hull project} is the path to the project folder \projects2021T2\Present2021T2, for example.

  • {JavaScript} is the script including the path: \myscripts\Hull_Clone\recalculate.js.

  • {--|/jsArgs js_arg_1 js_arg2 .... js_argn} is the option to pass values from the command line directly to the JavaScript engine. The values must be preceded either by two dashes -- or /jsArgs. Any value which is separated with a space and is placed after one of these options will be added to the JavaScript variable process.argv.

Variables and 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.

See Recalculating all blocks for an example script.

Environment variables

Any environment variable that is available in the Hull application can be used in Hull Clone. They are part of the environment in which Hull Clone process executes. See Recalculating all blocks for an example of a batch file that runs the Hull Clone script with the correct environment settings.