# Create a rectangular waveguide that is joined with a circular waveguide with a transition

This script creates a rectangular waveguide that is joined with a circular waveguide with a transition. The total waveguide is centered at the origin and oriented along the Z axis.

```
#
# newFASANT script file
#
# It is ready to be loaded working on METER units
# Creates a rectangular waveguide that is joined with a circular
# waveguide with a transition. The total waveguide is centered at the
# origin and oriented along the Z axis.
# a: Width of rectangular waveguide, in X axis
# b: Depth of rectangular waveguide, in Y axis
# P1: Heigth of rectangular waveguide, in Z axis
# r: Radius of circular waveguide, in XY plane
# P3: Height of circular waveguide, in Z axis
# P2: Height of waveguides transition, in Z axis
#
# See farther information in "Design of Rectangular to Circular Waveguide
# Converter for S-Band Frequency"
#
# Parameters with fixed values
set a {0.0721}
set b {0.034}
set r {0.0497}
# Parameters with variable values
set P1 {0.02}#{0.005, 0.01, 0.015, 0.02, 0.025} #Length of rectangular segment (P1): d1, d2, d3, d4, d5
set P2 {0.275}#{0.1, 0.2, 0.25, 0.275, 0.3} #Length of transition segment (P1): d4, d8, d10, d11, d12
set P3 {0.03}#{0.015, 0.03, 0.045, 0.06, 0.075} #Length of circular segment (P1): d1, d2, d3, d4, d5
# Auxiliary parameters defined automatically
set $1 = -a/2
set $2 = -b/2
set $3 = -P1-(P2/2)
set $4 = P2/2
#rectangular waveguide
box -n rectangular -p $1 $2 $3 a b P1
explode -s rectangular
delete -s rectangular_1 rectangular_6
#circular waveguide
cylinder -n circular -p 0.0 0.0 $4 r P3
rotate -s circular -p 0.0 0.0 0.0 0.0 0.0 1.0 45.0
explode -s circular
#waveguides transition
connect2Surfaces -n transition_1 -p rectangular_2 circular_3
connect2Surfaces -n transition_2 -p rectangular_3 circular_2
connect2Surfaces -n transition_3 -p rectangular_4 circular_1
connect2Surfaces -n transition_4 -p rectangular_5 circular_4
```