from conjuror.plans.truebeam import OpenField, MLCLeafBoundaryAlignmentMode, TrueBeamMachine

# OUTWARD: Include intermediate boundaries in the field
procedure = OpenField(x1=-50, x2=50, y1=-51, y2=51, mlc_mode=MLCLeafBoundaryAlignmentMode.OUTWARD, beam_name="OUTWARD")
machine = TrueBeamMachine(mlc_is_hd=False)
procedure.compute(machine)
beam = procedure.beams[0]

# Generate MLC animation and zoom in on top edge
fig = beam.animate_mlc(show=False)
fig.update_layout(xaxis_range=[-20, 20], yaxis_range=[40, 60])
fig