Skip to content

Build a Twin with AI

An AI assistant can follow Your First Twin from CAD for you. It identifies and names the parts, builds axes with drives, and checks each axis by moving it. Watch its work in the viewer and step in at any time.

The assistant connects through the Model Context Protocol (MCP). It runs on your machine. realvirtual CONNECT runs on the same machine and passes its tool calls to the viewer in your browser. The viewer executes the calls. The model file is not uploaded, and CONNECT is not reachable from the internet. What the assistant reads from the twin goes to its AI service, as with any other request.

  • realvirtual CONNECT — the free gateway for Windows. Download it, start it, and complete the one-time free registration. It needs no installer and no admin rights. The video walkthrough shows these steps in 2.5 minutes.
  • An MCP assistant — this page uses Claude Code. Claude Desktop also works, but needs a small relay. See AI Assistant (Bridge).
  • A viewer with the editor — for building twins, the public demo or your licensed deployment. The viewer that CONNECT serves on localhost:5100 operates twins but does not contain the editor.

1. Register the endpoint with your assistant

Section titled “1. Register the endpoint with your assistant”

CONNECT’s MCP endpoint is on by default:

http://localhost:5100/mcp

In Claude Code, add it once:

Terminal window
claude mcp add --transport http realvirtual-CONNECT http://localhost:5100/mcp

Or put it into the project’s .mcp.json:

{
"mcpServers": {
"realvirtual-CONNECT": {
"type": "http",
"url": "http://localhost:5100/mcp"
}
}
}

Restart the assistant to load the server setting. To copy the address later, click Copy Endpoint URL in CONNECT’s tray menu.

Open the viewer and click AI control in the left tool strip, or open Settings ▸ AI. Switch AI control on. The viewer connects to CONNECT on its own; there is nothing to select.

The first time on a device, a dialog explains the assistant’s access to the scene, all signals and the simulation. This includes writing signal values. Read the dialog and confirm with Got it.

The one-time consent dialog before an AI assistant is connected: what the bridge hands over — Scene, Signals and Simulation — and the answers Not now, Configure… and Got it

For the hosted demo, CONNECT also asks once in the tray whether https://web.realvirtual.io may use the bridge. Allow access. CONNECT remembers your choice. This prompt does not appear for a page served by CONNECT itself.

In the public demo and in commercial deployments, AI control opens an AI window inside the viewer instead of the settings. The open-source (AGPL) build does not include it. CONNECT starts Claude Code or Codex on your PC for you and registers itself as their MCP server, so step 1 is not needed. Choose the assistant at the top of the window.

A status line shows whether the assistant can reach the scene. While it reads Scene access off, click Enable scene access and confirm the dialog with Got it. The line then reads Scene access on. If another viewer tab holds the connection, the line says so. A question about the scene sent without scene access is held back, and you can enable access and send it, or send it without scene access.

If the window is not offered, enable it in the CONNECT tray under Details ▸ MCP server ▸ Allow prompt window.

Check these two rows under Settings ▸ AI:

  • AI client names your assistant and confirms that it is connected.
  • Tools is not zero. It is the number of tools this viewer offers to the assistant.

Then ask the assistant to list the loaded nodes:

What is loaded in the viewer right now? List the nodes at the top level.

While the assistant works, an indicator next to the AI control button shows its current action, for example AI · Node tree.

Import the CAD file as described in step 2 of the CAD guide. Then ask the assistant:

Open the imported assembly in the Editor and work out what this machine does. Remove helper geometry such as work envelopes. Give the parts descriptive names, then build the kinematic axes with drives. Verify each axis by jogging it and show me a screenshot of every axis in motion. Save when you are done.

A good assistant first reads the viewer’s guide (web_help("kinematize")). It views the model from several sides and measures shapes and rotation axes before creating axes. It checks each axis by moving it, just as you would with Jog.

Each step is an editor undo step. Click Undo to reverse a change.

Specify the result in your prompt and leave the method to the assistant:

GoalPrompt
Understand an unknown modelDescribe this machine: which parts move, around which axes, and what is probably helper geometry?
Build one axisMake the slide a linear axis along its rail and add a drive. Jog it end to end and check nothing collides.
MaterialsAssign industrial materials: frame painted RAL 7035, guards transparent, fasteners steel.
Wire a PLCList every bindable slot and every signal the running interface offers, match them by their comments, and bind the pairs you are confident about.
Plan a lineSwitch to the Planner, place a feed conveyor, two buffer sections and a turntable, and connect them at the correct transfer height.

An assistant can write a note on the relevant node. Notes can describe an axis’s role or limits, or identify a part with a misleading name.

The notes are stored in the saved GLB and appear in the property Inspector. They remain available to the next person or AI session. See notes on a node.

Ask the assistant to record what it changes:

Start a macro called filling-station, then fix the stopper. Give a reason and a source for every step. Save the macro with the model.

While recording a macro, each model change the assistant makes through viewer commands becomes one line. Each line contains the command, its resolved targets and the assistant’s reason, for example “DFM-6-5 has a 5 mm stroke (part library)”. The macro is stored inside the saved GLB, and as macros/<name>.macro.json when a project folder is open.

A recorded macro can be replayed on a fresh copy of the model:

Replay the macro filling-station as a dry run first, then for real, and report every step that failed.

To replay the macro on a different copy, ask the assistant to import the macro first. The copy can be a fresh import of the same CAD or a colleague’s file. web_macro_import reads macros/<name>.macro.json from the open project folder. When no folder is open, it takes the macro as JSON pasted into the chat.

The replay reports each line as done, partial, failed or requires commercial edition. Changes you make by hand in the Editor are not recorded. An undo, redo or manual edit ends the recording and keeps everything recorded up to that point.

Two kinds of tools help the assistant avoid guessing:

  • Geometry checks — web_check_gap and web_check_contact measure the real, mesh-exact distance between two parts, optionally with drives moved to given positions first (for example “is the piston rod touching the bracket when the cylinder is extended?”). A check can be added to a macro as an assertion, so every replay verifies it again.
  • Part library — web_query("part.lookup", …) reads common pneumatic and electric drives from their type code (for example DFM-6-5: guided cylinder, 5 mm stroke, which sub-parts move). Treat it as a hint and confirm it with a geometry check.

A good prompt combines both: “Look up the cylinder, model the axis, then check the gap in both end positions before you save.”

  • The connection is local. CONNECT and the viewer run on your machine, and MCP clients from other machines are refused by default. The assistant sends what it reads from the twin — names, values, screenshots — to its AI service, like any other request you give it.
  • Write access is a switch. Use MCP server ▸ Allow write access in the tray menu to make the assistant read-only without a restart.
  • Undo works for the AI, too. Editor changes made by the assistant are ordinary undo steps.
  • Macros contain no code. A macro is a list of viewer commands, never a script, so replaying one from somebody else can only do what the commands allow. Ask for a dry run first to see the list.
  • Turn it off with the AI control switch under Settings ▸ AI. Pause there stops accepting connections without closing anything.