import FreeCAD
import FreeCADGui
import time
#Animate FreeCAD's Assembly2 

changeby = 5		#Enter the angle by degrees  to increment by
numOfLoops = 50		#Enter number of times you want to run the loop
constraintname= "angleConstraint01_mirror"

ang =FreeCAD.getDocument(FreeCAD.ActiveDocument.Name).getObject(constraintname).angle #Read the existing angle

for i in range(0,numOfLoops):			#Start loop
	ang = float(ang)+float(changeby)	#Add the degrees to change to existing angle.
	if ang >= 360:						#If the input is greater than 360 it quits
		ang=ang-float(360)
	if ang <= -360:						#If the input is less than -360 it quits
		ang=ang+float(360)
	print ang
	FreeCAD.getDocument(FreeCAD.ActiveDocument.Name).getObject(constraintname).angle = ang   #Rotate 

	FreeCAD.ActiveDocument.recompute()				#Recompute
	FreeCADGui.updateGui()							#Update the graphics.
	

