Duplicate an Harmonic Result Object

Goal: Given a selected harmonic result, duplicate it and sweep over the phase.

Code:

# nDiv is the number of results you want to create on a 360 basis,
# so setting to 30 will create a result every 12 degrees(360/30)
nDiv = 30   
angleInc = 360/nDiv

BaseResult = Tree.FirstActiveObject

for n in range(0,nDiv+1):
    angle = Quantity(str(n*angleInc) + ' [degree]')
    newResult = BaseResult.Duplicate()
    newResult.SweepingPhase = angle
    newResult.Name = 'Sweep At ' + str(n*angleInc)