Skip to content
fabian-flassig edited this page Jul 31, 2026 · 20 revisions

These pages contain a documentation of the PYTHA-Lua api for developers intent on creating plugins for PYTHA.

Recommended VS Code extension

For autocomplete, inline parameter documentation, snippets and a config.xml schema, install PYTHA Lua Support from the Visual Studio Code Marketplace. Every API entry in this wiki has a corresponding stub with @param / @return annotations and a direct link back here.

ext install pytha-3d-cad.pytha-lua-support

The same extension also contains the debugger for PYTHA plugins — see Debugging with VS Code.

Getting started

A basic understanding of the programming language Lua is required. Many resources on Lua can be found on the web, but the guide "Programming in Lua" is a very good starting point (note that this is the online version of a book and the most recent editions are only available in print). For hardcore-programmers, we recommend the Lua reference manual.

If you want to create your first PYTHA-Plugin, we recommend that you start from one of the provided samples. Take a look at the tutorial My first PYTHA-Plugin to get some ideas.

The PYTHA Lua API is split into different namespaces which have their own documentation:

  • pytha for PYTHA modelling functionality
  • pyui for creating user interfaces like dialog boxes
  • pyio for file IO and persisting settings
  • pyux for user interactions with the scene
  • pyplot for creating and managing plot sheets, details, sections and annotations
  • pydim for creating dimensions in the model
  • pymsg for cooperation between plugins via message handlers
  • pygeo for 2D geometry processing helpers (polygon cleanup, offsetting)
  • pymath for tensor and matrix math (multiplication, transposition) and quaternions

Notes

  • PYTHA uses Lua Version 5.3.
  • The PYTHA Lua runtime is a customized version with extensions to the Lua syntax and some restrictions regarding the standard libraries. See Lua Runtime
  • Plugins can be debugged in Visual Studio Code with breakpoints, variable inspection and stepping. See Debugging with VS Code

Clone this wiki locally