-
Notifications
You must be signed in to change notification settings - Fork 0
Manage Program Names And Comments
File: Process_Document_Scripts/Manage_Program_Names_And_Comments.py
Version: 1.0
Document Type: CATProcess
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.
| Requirement | Value |
|---|---|
| Python | >= 3.10 |
| pycatia | >= 0.10.0 |
| wxPython | Required |
| xlsxwriter | Not required |
| Open document | CATProcess |
- Open the CATProcess in CATIA
- Run the script — a progress bar shows each program as the tree is read
- Check the Job bar — initial, project, die and revision, read from the CATPart name
- Check Metal thicknesses — metal, master, die part code and spotting, per part operation
- Double-click a row, or select it and press Edit selected row
- Pick a name and comment, or compose one, then Stage
- 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 |
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 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 carriesSPOTTING +0.3MM BUILT INon its own line -
at the machine — the programs are unchanged and the comment tells the operator:
LEAVE 0.3MM FOR SPOTTING
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 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.
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.
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 | 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.
- 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 Descriptionplaceholder is read as no comment at all. - Two files live in
%APPDATA%\pycatia_scripts\Manage_Program_Names_And_Comments\:settings.jsonholds the programmer initial and the machine, nothing else;templates.jsonholds 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.
Getting Started
Contributing
- Copy Name and Colour
- Export Properties To CSV
- Find And Select By Name
- Hide Planes And Axis Systems
- Rename Hybrid Shapes
- Replace Name Hybrid Shapes
- Reset Visual Properties
- Screenshot White Background
- Swap Names
- Toggle Show Hide Geometric Set
- Add Border And Title Block
- Add Border And Title Block With Values
- Batch CATDrawing To DXF
- Batch CATDrawing To PDF
- Create Drawing Border And Title Block
- Create Drawing Border And Title Block With Values
- Export Drawing Dimensions To CSV
- Update All Drawing Views
- Update Title Block From Properties
- Update Title Block Headings
- Axis To Axis Keep History
- Axis To Axis Keep History And Structure
- Axis To Axis Keep Name
- Axis To Axis Keep Name And Structure
- Batch Isolate Geometric Set
- Check Duplicate Names In Geometric Set
- Check Open Bodies
- Colour Code By Geometric Set
- Copy Geometric Set To New Part
- Copy Parameters Between Parts
- Create Construction Planes
- Create Spline From Coordinates
- Create ISM OSM STEP Files
- Delete Deactivated Features
- Delete Hidden Elements In Geometric Set
- Export 3D Annotations To CSV
- Export All Parameters To CSV
- Export Curve Lengths Surface Areas To CSV
- Export Geometric Set Structure To CSV
- Export Holes To CSV
- Export Mass CoG Inertia To CSV
- Export Parameter Dependencies To CSV
- Export Points Axis and Geo Set To CSV
- Export Points Axis and Geo Set To XYZ
- Export Points Geo Set To CSV
- Export Points Geo Set To XYZ
- Export Sketch Constraints To CSV
- Extract Boundary Curves
- IGES Export Curve Axis
- Insert Points Catia
- Insert Points Catia Keep History
- Insert Points Catia With Names
- Insert Points Catia With Names Keep History
- Join Explicit No Connect
- Join Explicit No Connect Curve
- Join Explicit No Connect Surface
- List Properties To CSV
- Match Properties In Geometric Set
- Measure Curve With 3 Points As Circle
- Measure Curve With 3 Points As Circle Keep Con
- Measure Radius Surface
- Measure Radius Surface Keep Con
- Measure Radius Surface Keep Con Auto Edge
- Mirror Keep History
- Mirror Keep History And Structure
- Mirror Keep Name
- Mirror Keep Name And Structure
- Publish Hybrid Shapes In Geometric Set
- Reorder Geometric Set Alphabetically
- Rotate Angle Keep History
- Rotate Angle Keep History And Structure
- Rotate Angle Keep Name
- Rotate Angle Keep Name And Structure
- Rotate Three Points Keep History
- Rotate Three Points Keep History And Structure
- Rotate Three Points Keep Name
- Rotate Three Points Keep Name And Structure
- Scale Keep History
- Scale Keep History And Structure
- Scale Keep Name
- Scale Keep Name And Structure
- Select By Colour
- Spline Through Points In Geometric Set
- Translate Direction Distance Keep History
- Translate Direction Distance Keep History And Structure
- Translate Direction Distance Keep Name
- Translate Direction Distance Keep Name And Structure
- Custom Coordinate Airfoil Generator
- Ellipse Generator
- Hole Size Test Plate Generator
- Involute Gear Generator
- NACA 4 Digit Airfoil Generator
- NACA 5 Digit Airfoil Generator
- Plot 2D Function
- Plot 3D Parametric Curve
- Regular Polygon Generator
- Sine Wave Curve Generator
- Spring Generator
- Check Operation Parameters Against Limits
- Export NC Program Names To CSV
- Export Process Table Parameters
- Export Resource List
- Export Tool List From Process
- Manage Program Names And Comments
- Manage Tooling Catalog
- Rename Operations From Tool Name
- Batch Instance Name Equal Part Number
- Batch Rename Instances
- BOM Export To CSV
- BOM Export With Materials
- Check Missing Files
- Clash Detection Export
- Export Assembly As STEP
- Export Component Positions To CSV
- Save Child Parts To STEP
- Save Child Parts To STL
- Backup CATIA Settings
- Clear Script Settings
- Clear CATIA Temp Files
- Configure CATIA Version Settings
- Kill CATIA Processes
- Open CATIA Settings Folder
- Reset CATIA Settings
- Restore CATIA Settings
- Set CATIA Environment Variable
- Toggle CATIA No Start Document
Legal