Skip to content

Writing Scripts

KaiUR edited this page May 5, 2026 · 5 revisions

Writing Scripts

Scripts for CatiaMenuWin32 live in the KaiUR/Pycatia_Scripts repository. You can also add your own via a local folder or extra GitHub repo.

Folder Structure

Scripts must be placed in a subfolder — the subfolder name becomes the tab name in the app:

Any_Document_Scripts\
Part_Document_Scripts\
Process_Document_Scripts\
Product_Document_Scripts\

The setup\ folder is reserved for requirements.txt and never becomes a tab.

Required Header

Every script must include a structured metadata header that the app reads to display the tooltip and Script Details:

'''
    -----------------------------------------------------------------------------------------------------------------------
    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.
    Author:         Your Name
    Date:           DD.MM.YY
    Description:    Full description of what the script does.
                    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 — one line only; shown as subtitle on the script button
  • Description — full detail; continuation lines must be indented
  • dependencies — list all pip packages required
  • requirements — describes the CATIA state needed to run the script

Naming

Use Snake_Case_Descriptive_Name.py. The app converts underscores to spaces automatically — Export_Points_To_CSV.py becomes Export Points To CSV in the button.

Dependencies

Add any pip packages your script requires to setup/requirements.txt in your repository. The app's ↧ Deps button installs them automatically.

Contributing Scripts

See CONTRIBUTING.md in the scripts repository for full contribution guidelines.

Clone this wiki locally