GUI Manual · Chapter 4

title: "Run Module" chapter: 4 source: "Doc/QMachineStudio UserManaul.pdf" images:

  • run-module.png
  • run-module-sequence.png

Run Module

Run Module is where the scripts that actually drive the machine live. It is organized into four building blocks — variables, functions, sequences, and steps.

Run Module overall screen
Run Module overall screen

Parts

Variable

Global variables that carry machine state: counters, flags, target coordinates.

int    cycleCount = 0;
bool   initOk = false;
double lastTargetX = 0.0;

Variable names are unique across the project. Rename propagates automatically to every reference.

Functions

Reusable logic called from sequences — hardware checks, shared error handling, init routines.

bool MoveToLoadPos(void) {
    Motor[X].MoveAbs(100.0, true);
    Motor[Y].MoveAbs(50.0, true);
    return Motor[X].CheckInPosition(100.0)
        && Motor[Y].CheckInPosition(50.0);
}

Sequence

The machine's main state flow. During runtime, sequences run in order and only one step is active at any time.

Sequence editor
Sequence editor

Step

Sub-units inside a Sequence. NextStep("Name") transitions to the next step, and entry/exit times are logged automatically.

Editing flow

  1. Declare globals in the Variable tab
  2. Write reusable logic in Functions
  3. Create the Main Sequence and describe each Step
  4. F6 to save/build, F5 to run and verify

Tips

  • Keep sequences short. One step ≈ one state transition — keeps debugging clear.
  • Move duplicated logic into Functions.
  • Use meaningful names: F12 jumps to definition, Shift + F12 finds references.