Getting Started

This guide assumes you have a basic understanding of the Forge language. If you need an introduction to Forge, check out the Forge language documentation.

Installing CnD

You can install CnD in one of the following ways:

  1. A stable, but less often updated version of CnD is packaged with the Forge VS Code Extension. This automatically launches CnD at localhost:3000.
  2. NPM: CnD is available as an NPM package. You can install and launch CnD as follows:
1
2
npm i cope-and-drag # Install
copeanddrag --port 3000 # Port is optional, defaults to 3000
  1. From a specific GitHub release : Download CnD from GitHub releases and run node index.js

Running CnD with Forge

These instructions assume that you have an actively running CnD server on port 3000. If you are using the Forge VS Code Extension, you will not have to manually launch CnD.

  1. Run a Forge specification that includes a run statement (an example is available here).
  2. This will open up Sterling, the default Forge visualizer, in a browser window. Run your command, and then, once Sterling displays a graph, click the Layout drawer. Select Load Layout to load the graph in Cope and Drag. If you already have a Cope and Drag specification, you can paste it in here before clicking load layout.
No Code Interface Screenshot
Click the highlighted button to open the Sterling Layout Drawer
  1. CnD will now open in a different tab. You can now start adding constraints that define spatial relationships between elements and directives that control visual styling and representation. These can be expressed both via YAML and a structured, no-code interface. If you are just starting with CnD, we recommend beginning with the No Code interface.
YAML Interface Screenshot
YAML Interface for Authoring Diagrams
No Code Interface Screenshot
No Code Interface for Authoring Diagrams
  1. Once you have clicked 'Apply Layout', CnD will apply your specification to generate a new diagram.

Next Steps