9.5. The Blade Runner Script Editor

Blade Runner is IQcad’s built-in editor for Python and Pascal scripts. It runs inside IQcad against the open drawing, so a script can be written, run, corrected and re-run without leaving the application or reloading anything.

Open it with the BLADE command (alias BLADERUNNER). The window is non-modal: leave it open beside the drawing while you work.

The languages themselves are documented in Python Scripting Reference and Pascal Scripting; this chapter covers the editor.

9.5.1. Buffers and Files

Open scripts appear as tabs across the top of the editor. Each tab keeps its own caret position, scroll offset, undo history and language; switching tabs swaps the editor content.

Action

Shortcut

Notes

New Python

Ctrl+N

Opens an empty buffer with Python syntax highlighting.

New Pascal

—

The same for Pascal.

Open…

Ctrl+O

The language follows the file extension: .py or .pas.

Open Recent

—

The ten most recently opened scripts, kept across sessions.

Save

Ctrl+S

Save As…

Ctrl+Shift+S

Close

Ctrl+W

Closes the current tab; you are asked about unsaved changes.

9.5.2. Running a Script

Action

Shortcut

Notes

Run

F5

Runs the whole buffer against the active drawing.

Run Selection

Shift+F5

Runs only the highlighted text — the fastest way to try one call without splitting the file.

Output appears in the pane below the editor: everything the script prints (iqcad.write_line and its Pascal equivalent) is tee’d there as well as to IQcad’s command line, so nothing is lost if the editor is closed. Runtime errors are reported in the same pane with their message and, where the host provides it, the line number.

Esc interrupts a long-running script — see Responsiveness and Esc in the scripting chapters.

Toggle the output pane from View › Output; drag the splitter to resize it.

9.5.3. The Sidebar

An activity bar down the left edge switches the sidebar between four panels. Ctrl+B shows and hides the sidebar; the panel you were last on, and the sidebar width, are remembered between sessions.

Panel

Contents

Recent

The recent-files list. Double-click, or select and press Enter, to open one.

Snippets / Samples

The sample scripts shipped with IQcad, Python first and then Pascal, each group sorted by name. Open one to use it as a starting point.

Outline

The symbols in the current buffer: def and class for Python (indented by nesting), procedures, functions and type declarations for Pascal. Click a symbol to jump the caret to its line.

Explorer

A file tree rooted at a folder of your choosing — point it at your script library and open files straight from it.

9.5.4. Find, Replace and Navigation

Action

Shortcut

Notes

Find

Ctrl+F

Opens the find bar with Aa (match case), W (whole word) and .* (regular expression) toggles, and a live match count.

Replace

Ctrl+H

Adds the replace field, with Replace and All.

Find Next / Previous

F3 / Shift+F3

Go to Line

Ctrl+G

Esc closes the find bar.

9.5.5. The Command Palette

F1 opens a command palette over the editor. Type any part of a command name — the match is fuzzy, so rsel finds Run Selection — and press Enter to run the top hit. Every editor action is reachable this way, with its shortcut shown beside it.

9.5.6. Appearance

View › Theme switches between the dark theme (the default, a VS-Code-style palette) and a light one. The choice applies to the editor, both syntax highlighters and the surrounding panels, and is remembered.

Window position and size, the output-pane height, the sidebar state and the theme are all stored in IQcad’s settings.json — see Application Settings.