Thank you for your interest in contributing. This repository is a collection of PyCATIA scripts for CATIA V5 automation, used with CatiaMenuWin32.
- Report a bug — open a Bug Report issue
- Suggest a script — open a Feature Request issue
- Submit a new script — follow the guidelines below and open a pull request
- Fix or improve an existing script — open a pull request with your changes
| Folder | Use when |
|---|---|
Any_Document_Scripts/ |
Script works on any open CATIA document |
Drawing_Document_Scripts/ |
Script requires an open CATDrawing document |
Part_Document_Scripts/ |
Script requires an open Part document |
Process_Document_Scripts/ |
Script requires an open Process document |
Product_Document_Scripts/ |
Script requires an open Product document |
Shape_Generation_Scripts/ |
Script generates geometry into the active CATPart document |
If your script doesn't fit any existing folder, propose a new one in your pull request.
Use Snake_Case_Descriptive_Name.py. The launcher converts underscores to spaces automatically — Export_Points_To_CSV.py becomes "Export Points To CSV" in the app.
Every script must include a properly formatted metadata header as the first item in the file. CatiaMenuWin32 reads this to display the script name, purpose, and description in its tooltip:
'''
-----------------------------------------------------------------------------------------------------------------------
Script name: Your_Script_Name.py
Version: 1.0
Code: Python3.10.4, Pycatia 0.8.3
Release: V5R32
Purpose: One line summary — shown on the script button in CatiaMenuWin32.
Author: Your Name
Date: DD.MM.YY
Description: Full description of what the script does, what inputs it needs,
and what outputs it produces. Continuation lines must be indented.
dependencies = [
"pycatia",
]
requirements: Python >= 3.10
pycatia
Catia V5 running with an open part document.
-----------------------------------------------------------------------------------------------------------------------
'''Header rules:
- Must be inside a triple-quoted string at the top of the file
Purpose— keep to one line, shown as subtitle on the script buttonDescription— full detail, continuation lines must be indenteddependencies— list all pip packages requiredrequirements— describe the CATIA state needed to run the script
If your script requires packages not already in setup/requirements.txt, add them.
- Test with CATIA V5 running
- Test with CatiaMenuWin32 if possible — confirm the tooltip shows correctly
- Make sure the script handles errors gracefully (e.g. wrong document type open)
- Fork the repository
- Create a branch:
git checkout -b feat/my-new-script - Add your script to the correct folder
- Update
setup/requirements.txtif needed - Commit with a clear message:
feat: add Export_Points_To_CSV script - Push and open a pull request against
main
- Python 3.10+ compatible
- Use PyCATIA for all CATIA interactions — see PyCATIA documentation
- Use
wxPythonfor any GUI dialogs (message boxes, file pickers) - Keep scripts self-contained — one file per script
- Handle common errors (wrong document type, nothing selected, CATIA not running) with clear user messages
- Store all user-configurable settings in
%APPDATA%\pycatia_scripts\<Script_Name>\using the persistent data pattern — never ask users to edit a script directly (CatiaMenuWin32 verifies script hashes before running) - All dialog scripts must include the
_bring_to_fronthelper and call it viawx.CallAfterbeforeShowModal()— CATIA holds the foreground lock and a plain dialog will appear behind it
CI runs ruff on every push and pull request. Your script must pass before it can be merged.
| Category | Rules |
|---|---|
E — pycodestyle |
Syntax errors, indentation, whitespace, statement structure |
F — pyflakes |
Undefined names, unused imports, redefined variables |
| Rule | Reason |
|---|---|
E501 |
Line length — scripts use right-aligned inline comments; not enforced |
- Unused imports (F401) — only import what your script actually uses
- Undefined names (F821) — check all variable references, especially after renaming
- Unused local variables (F841) — if you must suppress, prefix with
_(e.g._app = wx.App(None)) - Multiple statements on one line (E701) —
if x: ymust be split to two lines
pip install ruff
ruff check .
The setup/ and .github/ directories are excluded.
Author: Kai-Uwe Rathjen