-
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 can be renumbered across the process in one pass. 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
- Check the Job bar — initial, project, die, revision, code, metal and master
- 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 |
| 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 |
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 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.
| 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.
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 | 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 |
- 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. - 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.
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