UG/NX Post Tcl Tools
A focused VS Code toolbox for Siemens NX/UG Post Builder files. It turns mixed .tcl, .def, and .pui postprocessor projects into a more readable, navigable, and previewable editing experience.
Highlights
- Rich language support for NX postprocessor Tcl, DEF, and PUI files.
- Syntax and semantic highlighting for
PB_CMD_*, MOM_*, mom_*, pb_*, NC words, Tcl variables, DEF declarations, strings, comments, numbers, and operators.
- Hover previews for Post Builder
FORMAT, ADDRESS, and BLOCK_TEMPLATE definitions.
- BLOCK_TEMPLATE previews resolve static Tcl values such as
$mom_sys_output_code(INCREMENTAL), $mom_sys_home_pos(0), and leader references like [$mom_sys_leader(X)].
- Cross-file indexing across matching
.tcl, .def, and .pui files.
- Ctrl+Click / F12 navigation for Tcl procs, DEF formats, addresses, block templates, and PUI event commands.
- Context-aware completions for Tcl procs, block templates, addresses, formats, events, variables, common snippets, the NX 2506 native
MOM_* command catalog, and the full system mom_* variable catalog.
- Native
MOM_* commands are distinguished from user event procedures and provide Siemens NX 2506 calling syntax and descriptions on hover.
- Hover documentation for system MOM variables, including category, data type, default, possible values, and the Siemens description.
- A
UG/NX Post Events explorer view that groups PUI event sequences and opens the best available Tcl or DEF target.
- A Post Builder aware formatter that keeps braces, continuation lines, table-like PUI rows, and Tcl section dividers tidy.
Preview Examples
Hover a format definition:
FORMAT Feed "&__7.2_"
The preview explains width, decimal places, sign behavior, padding, and example output.
Hover an address:
ADDRESS X
{
FORMAT Coordinate
LEADER [$mom_sys_leader(X)]
}
The preview shows the address settings, linked format, resolved leader, and sample output such as X0.000.
Hover a block template:
BLOCK_TEMPLATE tool_change_3
{
G_mode[$mom_sys_output_code(INCREMENTAL)]
G[30]
X[$mom_sys_home_pos(0)]
Y[0]
}
The preview shows the raw template items and a compact NC-style output preview such as:
G91 G30 X0.000 Y0.000
Use Format Document after opening a file in UG Tcl mode. The formatter uses 3-space indentation and understands Tcl/DEF/PUI nesting, escaped braces, escaped quotes, hashes inside strings, and continuation-line indentation.
Development
Run the test suite from this extension folder:
npm test
Package and install locally:
npx --yes @vscode/vsce package
code --install-extension .\ug-tcl-tools-0.1.32.vsix --force
| |