Skip to content

Manage Program Names And Comments

KaiUR edited this page Jul 21, 2026 · 12 revisions

Manage Program Names And Comments

File: Process_Document_Scripts/Manage_Program_Names_And_Comments.py
Version: 1.0
Document Type: CATProcess


Description

Lists the whole machining tree — part operations, manufacturing programs and their operations — with each activity's name, comment, tool and machining settings, and sets names and comments from template lists.

The settings shown are the same ones Export Process Table Parameters exports, read by parameter name so operation types whose parameters sit at different indices still report correctly. A setting counts as missing only where another operation of the same type has one, so a pencil trace is not flagged for the stepover it never had.

Nothing is written to the document until Apply is pressed, and only values that actually differ from what is there are written.


Requirements

Requirement Value
Python >= 3.10
pycatia >= 0.10.0
wxPython Required
xlsxwriter Not required
Open document CATProcess

Usage

  1. Open the CATProcess in CATIA
  2. Run the script
  3. Check the Job bar — initial, project, die, revision, code, metal and master
  4. Double-click a row, or select it and press Edit selected row
  5. Pick a name and comment, or compose one, then Stage
  6. Apply staged edits to CATIA writes them; save the document in CATIA to keep them
Button Does
Edit selected row Opens the name and comment dialog for that activity
Renumber programs Numbers the programs in sequence, or by hand
Refresh from CATIA Reads the whole tree again
Clear staged edit Drops the staged values on the selected row
Apply staged edits to CATIA Writes every staged value

Program comments

A program comment is composed rather than typed:

32BN SEMI-FINISH SWEEP TO +0.3MM
32BN FINISH SWEEP TO 0.0MM (M/C: -0.7MM)
Piece Where it comes from
Tool The program's tool change, closed up for a ball nose — T2 32 BN becomes 32BN
Description The description list
TO ...MM The stage: rough +2.0 or +0.7, semi-finish +0.3, finish 0.0, Z check 0.0
(M/C: ...MM) What the operations actually machine to, from Offset on part

The stage figure is what the stage always means and does not move when metal comes off. The machined figure does, and is shown only when the two differ — so a part that is its own master reads TO 0.0MM with nothing after it.


The offset rule

The master side is cut to nominal; the other side has the metal taken off it. BOTH means no metal comes off either side.

Master Upper parts Lower parts
UPPER nominal nominal - metal
LOWER nominal - metal nominal
BOTH nominal nominal

Worked through, metal 0.7 with UPPER IS MASTER:

Stage Upper part Lower part
Z-level rough +2.0 TO +2.0MM TO +2.0MM (M/C: +1.3MM)
Rough +0.7 TO +0.7MM TO +0.7MM (M/C: 0.0MM)
Semi-finish +0.3 TO +0.3MM TO +0.3MM (M/C: -0.4MM)
Finish 0.0 TO 0.0MM TO 0.0MM (M/C: -0.7MM)

The rule is only a fallback. Where the operations state an Offset on part, that is used instead and the rule is used to check it — a program whose operations disagree with its stage is reported rather than corrected.


Where the job details come from

Detail Source
Project, die, revision The CATPart file name — TJ862, D20_08
Metal thickness, master The design part, from the body naming them: MASTER PANEL RH CP12 REV47 - UPPER IS MASTER - METAL IS 0.7mm
Side The UPPER / LOWER prefix on the die part name
Die part code Suggested from the die part name — LOWER POST is LP — and editable
Programmer initial Typed once and remembered

Metal belongs to the panel, so it is read per part operation: two die parts of different thickness each get their own. Where one part names more than one thickness, the choice is offered with the body name each came from.

Nothing here is guessed. A die number found only as an OP number is reported unconfirmed, and a part whose side cannot be read from its name gets no offset at all — being wrong about the side is wrong by the whole metal thickness.


Program names

Programs are named as one token:

K   862   D20   08   US   01
|   |     |     |    |    +-- program number
|   |     |     |    +------- die part code
|   |     |     +------------ revision
|   |     +------------------ die number
|   +------------------------ project number
+---------------------------- programmer initial

Renumber programs numbers them in sequence from a starting number and step, or one at a time by typing in the Number column. Dividers take no number and are skipped. Rebuild the whole name from the job settings switches between regenerating the whole token and changing only the trailing number.

A trailing number is read as a program number only where the name is built on the job's stem. A program CATIA named itself — Manufacturing Program.19 — ends in CATIA's own activity counter, so it is ignored and the next free number is offered instead.


Colour key

Colour Row
Blue Part operation
Amber Divider — a program carrying a *** heading ***
Grey-blue Manufacturing program
Lavender Operation
Green Staged, waiting for Apply
Red text A setting this operation type should have but does not

Notes

  • Nothing is written until Apply. Edits are staged beside the current values and shown in green. Opening a row and pressing Stage without changing anything stages nothing.
  • Placeholders in a template — **.**MM, ***mm, 0.*mm, POS_## — are asked for when the edit is staged, and the template's own spelling of the unit is kept.
  • CATIA's No Description placeholder is read as no comment at all.
  • Templates are embedded in the script; user additions go to %APPDATA%\pycatia_scripts\Manage_Program_Names_And_Comments\.
  • Only the programmer initial and the default machine are remembered between runs. Project, die, revision, metal and master belong to the document and are read from it every time, so a part name that fails to parse can never inherit the last job's die number.

Home


Getting Started


Contributing


Any Document Scripts


Drawing Document Scripts


Part Document Scripts


Shape Generation Scripts


Process Document Scripts


Product Document Scripts


Utility Scripts


Legal

Clone this wiki locally