Skip to content

Hole Size Test Plate Generator

KaiUR edited this page Jul 20, 2026 · 4 revisions

Hole Size Test Plate Generator

File: Shape_Generation_Scripts/Hole_Size_Test_Plate_Generator.py
Version: 1.4
Document Type: Part


Description

Generates a flat rectangular pad with a grid of through-holes of incrementally increasing diameter. Use this plate to test drill bit sizes, pin gauges, clearance fits, or any other hole-dependent process. The grid layout is calculated automatically from the hole count. Settings are saved between sessions.


Requirements

Requirement Value
Python >= 3.10
pycatia >= 0.10.0
wxPython Required
Open document Part
Hybrid Design Mode Should be off (script handles this automatically)

Usage

  1. Open a CATPart document
  2. Run the script
  3. The parameter dialog appears — enter your plate and hole parameters (see below)
  4. Click OK — a progress bar shows while the geometry is being created
  5. The test plate is added as a new body in the part

Parameters

Parameter Description Default
Pad Width Width of the plate in the X direction (mm) 300.0 mm
Pad Length Length of the plate in the Y direction (mm) 300.0 mm
Pad Thickness Height of the plate in the Z direction (mm) 5.0 mm
Number of Holes Total hole count; layout is calculated automatically 9
Starting Diameter Diameter of the first (top-left) hole (mm) 2.0 mm
Diameter Step Amount each subsequent hole diameter increases by (mm) 1.0 mm

Grid Layout

Holes are arranged in a rectangular grid, filled left-to-right and top-to-bottom in order of increasing diameter:

  • Columns = ceil(sqrt(n_holes))
  • Rows = ceil(n_holes / cols)

Example — 9 holes, start 2 mm, step 1 mm:

[D2]  [D3]  [D4]
[D5]  [D6]  [D7]
[D8]  [D9]  [D10]

A step of 0 creates a grid of identical holes. A negative step creates holes in decreasing order.


Dialog Buttons

Button Action
OK Validates inputs and generates the test plate
Cancel Exits without generating
Reset Defaults Restores factory default values (fields flash green)
Clear Saved Deletes the saved user presets file
Help Opens the full in-script user manual

Fit Validation

The dialog shows a live grid preview including cell size and the percentage of the cell used by the largest hole. The script warns or errors if:

  • The largest hole uses more than 85% of the cell width (tight fit warning — can proceed)
  • The largest hole diameter meets or exceeds the cell size (error — must change values)
  • Any hole would have zero or negative diameter (error)

Settings Persistence

Parameters are saved automatically to:

%APPDATA%\pycatia_scripts\Hole_Size_Test_Plate_Generator\user_presets.json

The next time the script runs, your last-used values are pre-filled in the dialog.


Notes

  • The plate is centred on the XY plane origin
  • The body is named with all key parameters for easy identification (e.g. Test Plate | 300.0x300.0x5.0mm | 9 Holes | D2.00-D10.00mm | Step:1.00mm)
  • Each hole is a CATIA Part Design Hole feature (through-all, simple type), named with its index and diameter (e.g. Hole_01_D2.00mm)
  • Hole sketches are hidden automatically to keep the feature tree clean
  • If an error occurs during generation the incomplete body is automatically deleted and a detailed error report is shown
  • Hybrid Design Mode is temporarily disabled during generation if it is on, and restored afterwards

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