It reads the scheduled shift and outputs an error.
The error in the scheduled shift is detected and the error can be displayed before going to the constraint engine.

import sc3
import ctypes
MessageBox = ctypes.windll.user32.MessageBoxW


def Consecutive_3Days_Off_check():
    for person in A_Member_in_All:
        for day in AllDays:
            if day<StartDate:
                continue

            ts=shift_schedules[person][day][0]# Read Schedule taple1 is solve level
            tsy=shift_schedules[person][day-1][0]#Read Schedule taple1 is solve level
            tsyy=shift_schedules[person][day-2][0]#Read Schedule taple1 is solve level

            s='Prohibit 3 Consecutive Days off'+staffdef[person] +' '+ daydef[day] +'\n'
            if  ts=='Day Off' and  tsy=='Day Off' and tsyy=='Day Off':
                print( '*****3 Consecutive Day Off Error '+s)#Output Error
                res=MessageBox(HWND,'Are you sure you want to continue?','Continue',3)
                if res !=6:
                    return
            x0=sc3.GetShiftVar(person,day,'Day Off')
            x1=sc3.GetShiftVar(person,day-1,'Day Off')
            x2=sc3.GetShiftVar(person,day-2,'Day Off')
            
            sc3.AddHard(~x0 | ~x1 | ~x2,s)#Prohibit 3 Consecutive Days Off as a hard constraint
        
Consecutive_3Days_Off_check()

Note:
3 consecutive Days Off is expressed by (x0 & x1 & x2).
Prohibit the pattern is expressed by ~(x0 & x1 &x2).
Finally,
~(x0 & x1 &x2) ⇒ ~x0 | ~x1 | ~x2