Skip to content

Sine Wave Curve Generator

KaiUR edited this page May 31, 2026 · 1 revision

Sine Wave Curve Generator

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


Description

Creates a sine wave curve in the active CATPart using GSD geometry. The user specifies amplitude, period, phase, X range, and number of points. The curve is defined as:

y = A · sin(2π / T · x + φ)

where A = amplitude, T = period (wavelength), φ = phase in degrees. Points are placed in a Points sub-set and connected by an open GSD spline. The output plane selects which axes carry the X and Y directions.

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 wave parameters 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 open spline

Parameters

Parameter Description Default
Amplitude Peak deviation from zero in mm. The wave oscillates between −A and +A. 10.0
Period Length of one complete cycle in mm (wavelength). Must be greater than zero. 100.0
Phase Horizontal shift in degrees. 0° starts at zero rising; 90° starts at peak. 0.0
X start Start of the X range in mm. 0.0
X end End of the X range in mm. Must be greater than X start. 300.0
Points Number of sample points. Minimum 2. 100
Plane Output plane: XY, XZ, or YZ XY

Plane Orientation

Plane Wave runs along Oscillates in
XY X Y
XZ X Z
YZ Y Z

Dialog Buttons

Button Action
OK Validates inputs and generates the sine wave
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 Sine_Wave_A{a}mm_T{t}mm is created at the top level of the part tree containing:

Sine_Wave_A10mm_T100mm
├── Points
│   ├── Pt_0001
│   ├── Pt_0002
│   │   ...
│   └── Pt_0100
└── Sine_Wave_Spline  (open)

The spline is open (not closed).


Settings Persistence

Settings are saved automatically to:

%APPDATA%\pycatia_scripts\Sine_Wave_Curve_Generator\user_presets.json

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


Notes

  • The amplitude in the geo set name is the integer part of the input value (e.g. 10.5A10mm)
  • Use more points for high-frequency waves or very long X ranges to maintain spline smoothness
  • Phase of 90° starts the wave at its positive peak; −90° starts at its negative peak

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