Skip to content

Ellipse Generator

KaiUR edited this page May 31, 2026 · 1 revision

Ellipse Generator

File: Shape_Generation_Scripts/Ellipse_Generator.py
Version: 1.0
Document Type: Part


Description

Generates a parametric ellipse in the active CATPart using GSD geometry. The user specifies a semi-major axis (a), semi-minor axis (b), number of points, and output plane. Points are distributed evenly by angle using the parametric form x = a·cos(t), y = b·sin(t).

The script creates a geometric set containing:

  • A Points sub-set with all N sample points
  • A closed GSD spline (Ellipse_Spline) through all points

When a = b the result is a circle. Settings are saved between sessions.


Requirements

Requirement Value
Python >= 3.10
pycatia >= 0.8.3
wxPython Required
Open document Part

Usage

  1. Open a CATPart document
  2. Run the script
  3. Enter the semi-major axis, semi-minor axis, number of points, and output plane in the dialog
  4. Click OK — a progress bar shows while geometry is created
  5. A new geometric set is added to the part containing the point set and closed spline

Parameters

Parameter Description Default
Semi-major axis (a) Longer half-axis length in mm. Must be greater than zero. 100.0
Semi-minor axis (b) Shorter half-axis length in mm. Must be greater than zero. 50.0
Number of points Number of evenly-spaced sample points on the ellipse. Minimum 4. 72
Plane Output plane: XY, XZ, or YZ XY

Plane Orientation

Plane First axis Second axis
XY a along X b along Y
XZ a along X b along Z
YZ a along Y b along Z

Dialog Buttons

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

Output

A geometric set named Ellipse_A{a}mm_B{b}mm is created at the top level of the part tree containing:

Ellipse_A100mm_B50mm
├── Points
│   ├── Pt_001
│   ├── Pt_002
│   │   ...
│   └── Pt_072
└── Ellipse_Spline  (closed)

The spline passes through all N points and is closed, ready to use as a pad or pocket profile.


Settings Persistence

Settings are saved automatically to:

%APPDATA%\pycatia_scripts\Ellipse_Generator\user_presets.json

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


Notes

  • The ellipse is centred at the origin; the first point starts at (a, 0, 0) for XY and XZ planes
  • 72 points gives one point every 5° — a smooth spline for most uses; use 36 for lighter models
  • When a = b, the result is a circle of radius a

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