# Server for Constant Remote Models (CugServer)

## Getting Started with ConstantRemoteModel (CAE Viewer)

The ConstantRemoteModel supports an efficient and scalable streaming of pre-defined CAE model configurations. The streaming also starts immediately when a model is opened, no matter the size of the model. Similar to RemoteModel, it utilizes 3D Progressive Object Streaming to the client. The model needs to be converted into a CUG database format before it can be streamed. See CugComposer for more info on how to prepare data.

The server (CugServer) is a stateless REST API based server that has very low resource usage on the server side and is easy to load balance. It is delivered as source code (JavaScript) and only requires Node.js to run.

To start the server, follow these steps:

1. Download and extract HOOPS Envision for Web distribution archive from the Tech Soft 3D Developer Zone: https://developer.techsoft3d.com/

2. With a terminal prompt, go to the ‘server/CugServer’ folder inside the distribution.

3. Execute the following command to fetch CugServer’s dependencies (e.g. Express)

       > npm install

4. Start the server using npm:

   Start the server with the npm start command:

       > npm start

## Configuring the CugServer

To configure the CugServer, use the following environment variables:

- CEW_CUGS_PORT: Port number for the server. Default: 8090.
- CEW_CUGS_FILE_DS_PATH: Path to the folder containing the ConstantRemoteModel database files. Default: “/../../TestModels/cugDb/
- CEW_CUGS_CONFIGURE_EXPRESS_APP_JS_FILE: Optional .js file that can be used to configure the Express app.
- CEW_CUGS_PUBLIC_DIR: Optional addition folder to serve static files from using Express.

You can also modify the source code if needed, but you are then responsible for keeping the code up to date with future updates of HOOPS Envision for Web.

## Logging in CugServer

The ConstantRemoteModel server (CugServer) supports logging to console and file in two different formats: Standard (more human readable) and JSON (for easy processing or consumption by e.g. Logstash).

The logging output of the ConstantRemoteModel server (CugServer) can be controlled via the following environment variables:

- CEW_CUGS_LOG_CONSOLE_OUTPUT_TYPE: Format for console log. Possible values: “standard”, “json”, “none”. Default: “standard”.
- CEW_CUGS_LOG_FILE_OUTPUT_TYPE: Format for console log. Possible values: “standard”, “json”, “none”. Default: “json”.
- CEW_CUGS_LOG_FILENAME: If file output type is not NONE, use this to specify the name of the log file. Default: “c3_ug_server.log”.
- CEW_CUGS_LOG_LEVEL: Specify what to log. Possible values: 1: Error, 2: Warning, 3: Info, 4: Debug, 5: Full debug. A 3 will log Error, Info and Warning, but not any debug messages. This is default.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Web in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Web?
What are the latest release notes for HOOPS Envision for Web?
How do I start evaluating HOOPS Envision for Web?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...