Build and Run a Server

The NC.js package is built from source using the Node Package Manager (npm). This will assemble all of the dependencies, including a pre-built version of the STEPNode plugin, then start the server on a STEP-NC file that you specify.

This package requires Node.js. You can download it from nodejs.org. At the time of writing we use Node 8.x LTS branch. Installing node also installs "npm" into your path.

After Node is installed, download the NC.js source code from GitHub.

> git clone https://github.com/steptools/NC.js.git

The STEP-NC file to use is named in the "config.js" file in the top level directory of the package. By default, the server will use the STEP-NC process and machine tool model sample files in the STEP-NC Desktop package.

To have the server display a different model, change the "file" object and "dir" key to the new file. You can find more sample files at www.ap238.org

"file" : {"dir": "path_to_file.stpnc"}

In the top level directory of the package, run "npm install". This will assemble all of the package dependencies. It will also download a pre-built version of the STEPNode plugin, but you may need to request a license key in order to run it.

> cd NC.js
> npm install

Once the dependencies have been assembled, you can build and start the server. When the server is running, point your web browser to http://localhost:8080/

> npm run make

> npm run make-release      # same, but minimizes file sizes

If the server has already been built, you can start it with "npm start". This will be faster than making everytime. You can also override the STEP model in "config.js" file by using a command line flag.

> npm start

> npm start -- -f "path_to_file.stpnc"

When you go to http://localhost:8080/ you should see a machining setup like the following:

Thread Example