JSlopeTerminal

GUI Commands in the Terminal

See the command behind each edit you make with the mouse, menus and dialogs, and reuse it in a script.

Each model edit you make in the JSlope interface runs a terminal command. The Console shows it as the line that repeats the edit, marked GUI, followed by its result. Draw a line from (0, 0) to (12, 4) and the Console shows:

› GUI cad.line.add from=[0,0] to=[12,4] id="cad-1790412345678-k3x9qa"

This is a quick way to learn the commands: make an edit in the interface, then read the line it produced. Lines are recorded while the terminal is hidden too, so showing it again shows the edits you have just made.

What is shown

ShownExamples
Model editsDrawing, moving and deleting objects; materials and their assignment; loads, supports and water; scenarios; settings you apply in a dialog; Simplify Geometry; the FEA water-table and failure-mass context-menu items
Undo and redohistory.undo from the toolbar or Ctrl+Z
Analyses, imports and project filesanalysis.lem.run scope="enabled" when you select LEM Compute, fea.stress.solve from Stress Solve, project.save from File > Save, project.import.rocfall2 from File > Import > RocFall2…, cad.image.import for a reference image, and the Server runs buttons
Where analyses runcompute.location.set rockfall="server" when you change a switch in Project Settings > Compute and select Apply

The result below each line is the same as for a typed command: ✓ with what the edit created, changed or deleted, or ✗ with the reason it was refused. An analysis appears when it finishes, with its result and report.

Some things are not shown:

  • Changes that do not edit the model, such as selecting, zooming, panning, and changing what is displayed.
  • Controls for a running analysis, such as pause and stop.
  • Previews while you drag or type. A drag shows one line, with the final position, when you release it. Pressing Escape during a drag of the slope limit markers cancels it: the limits go back to where they were, the results you have already computed are kept, and no line or undo step is added. Only releasing the marker at a new position changes the limits and clears the results that depend on them.
  • Commands you type in the Console or run in a script, which the terminal already reports.
  • Edits that do not have terminal commands yet: DXF geometry import, Slide2 material import, Cloud Materials, image calibration, Rockfall and Runout calibration, 3D workspace sections and print layouts.

Repeating GUI edits

Each line runs as written, so you can copy lines from the Console into the Script tab and run them again. Copying a row from the log copies its command line, without the GUI marker, but result rows between commands are copied too, so copy one line at a time. To collect several GUI lines, use Send GUI lines to Script, which adds every GUI line that succeeded to the Script tab in one step, or Save session as .slope, which saves them to a file (see the output log).

Coordinates and values are written exactly as the edit used them, including snapped points. Values the edit took from the interface are written out too, so the line does the same thing when it runs again:

  • support.add names the support material the drawing used, as material="…", whatever support material is selected when the line runs. weakLayerJoint.add names its Weak Layer/Joint property the same way. When that catalog is empty, starting the Weak Layer/Joint tool adds one first with weakLayerJointMaterial.add. Right-clicking an exterior joint endpoint and choosing Open or Closed echoes weakLayerJoint.setEndCondition with the boundary id and start or end.
  • material.assign.region names the regions it assigned, as target="profile" or target="analysis".
  • fea.stress.solve names the transient stage whose pore pressures it used, the stage the stage player showed.
  • The Project Berm tool writes rockfall.berm.add at=<crest x> height=… angle=…, which projects the same berm, including when the Toe Point snap moved it.

When an edit creates something and its command takes an id, as cad.line.add and material.add do, the line writes out the id JSlope picked, as id="…" above. This covers every id a command creates, except the Section Wizard geometry described below: the pieces of a Material Boundary, Profile Boundary or Tension Crack cut by clipping (-2, -3 and so on after the first), an Anisotropic Vector Field's control line (lineId=), the kept Previous Water Table (previousId= for water.table.set, id= for Convert to Static Water Table), the polyline Convert to Polyline adds from the FEA water table (id= of water.table.fromGroundwater), an object made by cad.construction.convert (newId=), pasted and duplicated objects (ids= and newIds=), and the scenarios and groups made by group.duplicate, parametric.applyBatch, parametric.sweep and section.apply newGroup=true. Later lines that change the same object name it by that id, so they still find it when the lines run as a script.

A GUI edit whose line would be longer than 20,000 characters, such as a large Define Properties Apply or a boundary with many vertices, is shown as a command over several lines, which runs as it is in a script.

Some lines do not repeat exactly:

  • cad.paste pastes whatever is copied when it runs. Copying is not a command, so copy the same objects before running a pasted line again.
  • Lines that open a file, such as project.open, project.import.rocfall2 or cad.image.import, ask for the file again.
  • server.run.apply and server.run.cancel act on the server run they name, which may have changed or expired.
  • A line is shortened to <command> … (arguments not shown: …), and cannot run, only when a single value, such as one very long text, is longer than 20,000 characters, or the whole command is over the 512 KiB script limit.