Skip to content

Script Object

Marius Stanciu edited this page Oct 29, 2026 · 1 revision

A Script object holds a Tcl script. You write the script in the Script Editor, save it, and run it. The script can read and change the project with the Tcl commands. See Tcl Scripting.

Where to find it

  • New Script command in the File menu: makes an empty Script object.
  • Open Script command in the File menu: opens a script file as a Script object.
  • Project tree: a Script row. The title of its Properties tab is Script Object.
  • The Script Editor is shown in the Properties tab of the object. Its buttons are Open, Save and Run.

Screenshot placeholder: images/Script-Object-1.png - the Properties tab of a Script object with the Name field, the Auto Completer check box and the Script Editor with its Open, Save and Run buttons.

Quick start

  1. Choose File > New > Script. A Script row is added to the Project tree.
  2. Type the Tcl commands in the Script Editor.
  3. Click Save in the Script Editor. Choose a file name in the dialog. The default filter is FlatCAM Scripts (*.FlatScript).
  4. Click Run in the Script Editor. The script runs. If an error is found, the editor shows the line of the error.

Parameters

Name and options

Parameter Description Default
Name (text box) The object name in the project. Press Enter to apply. Object name
Auto Completer (check box) Turns on the auto completer in the Script Editor. The completer suggests the command names while you type. On or off as saved in the project
Level (button) Switches the object between Beginner and Advanced mode. -

The Plot check box is hidden. A Script object is not drawn on the canvas.

Script Editor buttons

Button Description
Open Opens a script file in the editor. It replaces the text in the editor.
Save Saves the script. If the object has no file name yet, the save dialog opens. The default filter is FlatCAM Scripts (*.FlatScript).
Run Runs the script with the application. The text in the editor is used. If the script has an error, the editor goes to the line of the error.

Script text

The text area is the Script Editor. The text is the source of the object. Each change marks the project as changed.

Context menu

Right-click a Script row in the Project tree. See Objects Overview. Copy, Delete and Rename are used the same way as for other objects.

Advanced

  • Run in the Script Editor and in the Tcl Shell: the Run button runs the script with the same engine as the Tcl Shell. See Tcl Shell.
  • Command reference: each Tcl command is described in Tcl Command Reference.
  • Saving a script with a project: the script text is kept in the project file. A saved script file is a separate file on the disk.
  • Plot: the script object has no plot. A script does not add shapes to the canvas by itself. The commands it runs can add objects with plots.
  • Auto completer: the check box and the editor use the list of names of the application. The names of the objects are also in the list.

See also

Clone this wiki locally