From 9ed58f9b4a9e95e6183a2b94cf89ed39b41c8354 Mon Sep 17 00:00:00 2001 From: Michael Brunner Date: Wed, 10 Jun 2026 11:48:42 +0200 Subject: [PATCH 1/2] Add command line documentation and update navigation in mkdocs --- docs/command_line.md | 119 +++++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 2 + 2 files changed, 121 insertions(+) create mode 100644 docs/command_line.md diff --git a/docs/command_line.md b/docs/command_line.md new file mode 100644 index 0000000..ac5572d --- /dev/null +++ b/docs/command_line.md @@ -0,0 +1,119 @@ +# Run cadwork from the Command Line + +Besides starting cadwork by double-clicking a file, you can launch it from **cmd** or +**PowerShell** with `ci_start.exe`. Command-line arguments let you open a file, pick a specific +cadwork version, automatically run a Python script, or print plans — without touching the UI. + +Combined with a PowerShell loop, this turns cadwork into a tool you can drive over a **whole folder +of files at once** (batch processing) for exports, printing or any custom Python automation. + +!!! note + Exact paths (drive letter, version folder name) depend on your local installation. Replace the + paths in the examples below with the ones on your machine. + +## Locating `ci_start.exe` + +`ci_start.exe` is the cadwork launcher and lives in your `cadwork.dir` folder: + +```text +...\cadwork.dir\ci_start.exe +``` + +Each installed version has its own program folder next to it, named `exe_`: + +```text +...\cadwork.dir\exe_2026 +...\cadwork.dir\exe_2027 +``` + +## Opening a file and selecting the version (`/EXE=`) + +To open a `.3d` file, pass the file path to `ci_start.exe`. Use the `/EXE=` argument to choose +**which installed cadwork version** should open the file: + +```powershell +D:\cadwork.dir\ci_start.exe "C:\Users\Me\Downloads\timber-framed-elements.3d" /EXE=D:\cadwork.dir\exe_2026 +``` + +You can also launch it with PowerShell's `Start-Process`, which lets the prompt return immediately +and gives you control over the window state: + +```powershell +Start-Process "C:\Users\Me\Downloads\timber-framed-elements_2027.3d" -ArgumentList '/EXE=D:\cadwork.dir\exe_2027' +``` + +!!! note + `/EXE=` is especially useful when several cadwork versions are installed side by side — it + decides whether the file opens in, for example, the 2026 or the 2027 program. + +## Auto-running a Python script (`/PLUGIN=`) + +The `/PLUGIN=` argument runs one of your Python plugins automatically right after the file opens. + +```cmd +...\cadwork.dir\ci_start.exe "C:\path\to\myFile.3d" /PLUGIN=MyScript +``` + +The plugin name is the **name of the plugin folder** in your `API.x64` directory (the same folder +and script name you set up for the plugin bar). See [Getting Started](get_started.md) for how to +create and place a plugin. + +!!! tip + For unattended processing, let the script do its work and then save or export the result — for + example `file_controller.save_3d_file()` or an export controller call — so each file is + processed start to finish without any clicks. + +## Batch printing / export + +For `.2d` files you can print plotter or laser frames directly from the command line: + +```cmd +ci_start.exe "C:\path\plan.2d" /P A :: print all plotter frames to the default plotter +ci_start.exe "C:\path\plan.2d" /P 1-2;5;7 :: print plotter frames 1, 2, 5, 7 (and following) +ci_start.exe "C:\path\plan.2d" /L A :: print all laser frames to the default laser +ci_start.exe "C:\path\plan.2d" /L PDF :: print all laser frames to the default PDF driver +``` + +| Argument | Effect | +| --------------- | -------------------------------------------------------- | +| `/P A` | Print **all** plotter frames to the default plotter | +| `/P 1-2;5;7` | Print the **selected** plotter frames | +| `/L A` | Print **all** laser frames to the default laser | +| `/L PDF` | Print **all** laser frames to the default PDF driver | + +## Batch processing with PowerShell + +Put it together to process every file in a folder. The example below opens each `.3d` file with a +fixed cadwork version and runs an export plugin on it: + +```powershell +$exe = 'D:\cadwork.dir\ci_start.exe' +$exeDir = 'D:\cadwork.dir\exe_2026' +$files = Get-ChildItem 'C:\Projects\Batch' -Filter *.3d + +foreach ($file in $files) { + Write-Host "Processing $($file.Name)" + Start-Process -FilePath $exe ` + -ArgumentList "`"$($file.FullName)`"", "/EXE=$exeDir", '/PLUGIN=MyExportScript' ` + -Wait +} +``` + +!!! warning + The `-Wait` flag is important: it makes PowerShell wait until cadwork closes before opening the + next file, so the files are processed **one at a time** instead of launching dozens of cadwork + instances at once. For a fully unattended run, the plugin should save/export its result and + then close the file. + +## Other useful arguments + +A few additional arguments that are handy for everyday use: + +| Argument | Effect | +| ------------------- | --------------------------------------------------- | +| `/GET_LICENCE` | Print the currently selected default licence type | + +## See also + +- [Getting Started](get_started.md) — set up Python plugins in cadwork. +- [Videos](videos.md) — example videos, including how to use Python in cadwork. diff --git a/mkdocs.yml b/mkdocs.yml index c172431..444f058 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -104,6 +104,8 @@ nav: - Visualization Controller: examples/visualization_example.md - GUI: examples/tk_gui.md - Compare: examples/compare.md + - Command Line: + - command_line.md - Videos: - videos.md - Auto Attributes: From 230d713c6a406f4995e0004160efd21d5c98e260 Mon Sep 17 00:00:00 2001 From: Michael Brunner Date: Wed, 10 Jun 2026 16:05:37 +0200 Subject: [PATCH 2/2] Fix formatting and improve clarity in command line documentation --- docs/command_line.md | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/docs/command_line.md b/docs/command_line.md index ac5572d..fd11ce7 100644 --- a/docs/command_line.md +++ b/docs/command_line.md @@ -8,8 +8,8 @@ Combined with a PowerShell loop, this turns cadwork into a tool you can drive ov of files at once** (batch processing) for exports, printing or any custom Python automation. !!! note - Exact paths (drive letter, version folder name) depend on your local installation. Replace the - paths in the examples below with the ones on your machine. +Exact paths (drive letter, version folder name) depend on your local installation. Replace the +paths in the examples below with the ones on your machine. ## Locating `ci_start.exe` @@ -43,8 +43,8 @@ Start-Process "C:\Users\Me\Downloads\timber-framed-elements_2027.3d" -ArgumentLi ``` !!! note - `/EXE=` is especially useful when several cadwork versions are installed side by side — it - decides whether the file opens in, for example, the 2026 or the 2027 program. +`/EXE=` is especially useful when several cadwork versions are installed side by side — it +decides whether the file opens in, for example, the 2026 or the 2027 program. ## Auto-running a Python script (`/PLUGIN=`) @@ -59,9 +59,9 @@ and script name you set up for the plugin bar). See [Getting Started](get_starte create and place a plugin. !!! tip - For unattended processing, let the script do its work and then save or export the result — for - example `file_controller.save_3d_file()` or an export controller call — so each file is - processed start to finish without any clicks. +For unattended processing, let the script do its work and then save or export the result — for +example `file_controller.save_3d_file()` or an export controller call — so each file is +processed start to finish without any clicks. ## Batch printing / export @@ -74,12 +74,12 @@ ci_start.exe "C:\path\plan.2d" /L A :: print all laser frames to the def ci_start.exe "C:\path\plan.2d" /L PDF :: print all laser frames to the default PDF driver ``` -| Argument | Effect | -| --------------- | -------------------------------------------------------- | -| `/P A` | Print **all** plotter frames to the default plotter | -| `/P 1-2;5;7` | Print the **selected** plotter frames | -| `/L A` | Print **all** laser frames to the default laser | -| `/L PDF` | Print **all** laser frames to the default PDF driver | +| Argument | Effect | +| ------------ | ---------------------------------------------------- | +| `/P A` | Print **all** plotter frames to the default plotter | +| `/P 1-2;5;7` | Print the **selected** plotter frames | +| `/L A` | Print **all** laser frames to the default laser | +| `/L PDF` | Print **all** laser frames to the default PDF driver | ## Batch processing with PowerShell @@ -100,18 +100,21 @@ foreach ($file in $files) { ``` !!! warning - The `-Wait` flag is important: it makes PowerShell wait until cadwork closes before opening the - next file, so the files are processed **one at a time** instead of launching dozens of cadwork - instances at once. For a fully unattended run, the plugin should save/export its result and - then close the file. +The `-Wait` flag is important: it makes PowerShell wait until cadwork closes before opening the +next file, so the files are processed **one at a time** instead of launching dozens of cadwork +instances at once. For a fully unattended run, the plugin should save/export its result and +then close the file. ## Other useful arguments A few additional arguments that are handy for everyday use: -| Argument | Effect | -| ------------------- | --------------------------------------------------- | -| `/GET_LICENCE` | Print the currently selected default licence type | +| Argument | Effect | +| -------------- | ------------------------------------------------- | +| `/GET_LICENCE` | Print the currently selected default licence type | +| `/USP` | Define the directory for the Userprofile | +| `/CATDIR` | Define the directory for the Catalog | +| `/WORKDIR` | Define the directory for the Work folder | ## See also