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

An editor for the names and comments of a machining process. The part operations, manufacturing programs and operations of the active CATProcess are listed in one grid, each with its name, comment, tool and machining settings, so a whole job can be read and put right in one place. The settings columns are the ones Export Process Table Parameters writes to Excel — stepover, tolerance, depth of cut and offsets — alongside a warning where an operation is missing one its own type normally carries.

Names and comments are picked from template lists rather than typed: die parts and machines for a part operation, headings for a divider, machining descriptions for a program or an operation. Program names are assembled from the job — programmer, project, die, revision and die part — and renumbered part operation by part operation. Program comments are composed from the tool, the description and the two offsets, so a comment always says what the tool is, what it is doing and what it is cutting to.

Edits are staged and previewed against the current values, and the document is untouched until Apply is pressed.


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 — a progress bar shows each program as the tree is read
  3. Check the Job bar — initial, project, die and revision, read from the CATPart name
  4. Check Metal thicknesses — metal, master, die part code and spotting, per part operation
  5. Double-click a row, or select it and press Edit selected row
  6. Pick a name and comment, or compose one, then Stage
  7. 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
Metal thicknesses Metal, master, code and spotting for each part operation
Renumber programs Numbers the programs part operation by part operation
Refresh from CATIA Reads the whole tree again, behind the progress bar
Clear staged edit Drops the staged values on the selected row
Apply staged edits to CATIA Writes every staged value
Edit templates Adds, edits, reorders and removes the dropdown entries
Clear saved settings Deletes the saved files and restores the shipped templates
Help The whole of this page, inside the script

Metal thicknesses

Every thickness found in the design parts is listed with the master it was named with and the body name it came from — the same body carries both, as MASTER PANEL LH CP02 REV11 - UPPER IS MASTER - METAL IS 1.5mm. Rows can be added by hand where a part states nothing, and only rows added by hand can be edited or deleted.

Below, each part operation says which row applies to it, along with its die part code and spotting:

Part operation Code Metal mm Master Spotting mm Spotting Use
UPPER PAD (OKUMA) UP 1.5 UPPER 0.3 built in 1.5mm UPPER
LOWER POST (MECOF) LP 1.5 UPPER 1.5mm UPPER

Picking a row in Use fills the thickness and master together, so they cannot come from different rows. Where the whole process turns up a single thickness, every part operation defaults to it. Two die parts of different thickness each keep their own — there is no one figure for the job.


Spotting

Spotting is material left on for hand work at try out. It is set per part operation, either way:

  • built in — the allowance is added to every offset, so finish cuts to +0.3, and the comment carries SPOTTING +0.3MM BUILT IN on its own line
  • at the machine — the programs are unchanged and the comment tells the operator: LEAVE 0.3MM FOR SPOTTING

Program comments

A program comment is composed rather than typed:

16BN SEMI-FINISH SWEEP TO +0.3MM
16BN FINISH SWEEP TO 0.0MM (M/C: -1.5MM)
Piece Where it comes from
Tool The program's tool change, closed up for a ball nose — T4 16 BN becomes 16BN
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 on the master side reads TO 0.0MM with nothing after it.

A part operation comment is built from ticked lines — the job description, UPPER IS MASTER, METAL IS 1.5MM, PROFILES ARE ...MM with its own value box — with the master and metal lines already filled in from the design part.


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 1.5 with UPPER IS MASTER:

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

Whether a part is an upper or a lower one comes from the part operation's name — name it UPPER PAD and it is an upper part. A name that says neither, such as ROLLER CAM POS_01, gets no offset, because being wrong here is wrong by the whole metal thickness.

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.


Program names

Programs are named as one token:

A   104   D45   03   LP   01
|   |     |     |    |    +-- program number
|   |     |     |    +------- die part code
|   |     |     +------------ revision
|   |     +------------------ die number
|   +------------------------ project number
+---------------------------- programmer initial

The die part code belongs to the part operation, so two part operations in one process name their programs differently — ...UP01 under the pad, ...LP01 under the post.

Renumber programs groups the programs under their part operations, each with its own start and step on its header row, and numbering restarts for every part operation. Type in the Number column to set any one by hand. 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.14 — ends in CATIA's own activity counter, so it is ignored and the next free number is offered instead.


Templates

Every dropdown is fed by a list that Edit templates can change — die parts, machines, job descriptions, part operation comments, masters, dividers, operation descriptions, tools and die numbers. Entries can be added, edited, reordered, sorted and removed, and whole sets exported to a file and imported again, replacing or merging. Unticking Use the entries built into the script keeps only the entries added by hand; the shipped lists are always held, so any list can be put back.


Colour key

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

The three tree levels run from blue down to cream, so depth reads as brightness; dividers are amber to stand out from the programs they sit among.


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.
  • Two files live in %APPDATA%\pycatia_scripts\Manage_Program_Names_And_Comments\: settings.json holds the programmer initial and the machine, nothing else; templates.json holds the template lists once they have been edited. Clear saved settings deletes both.
  • Project, die, revision, metal and master belong to the document and are read from it every run, 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