import win32com.client as w32 dmisapp = w32.Dispatch('PCDLRN.Application') dmispart = dmisapp.ActivePartProgram dmiscommands = dmispart.Commands def pc_dmis_report(): for cmd in dmiscommands: if cmd.IsDimension and int(cmd.DimensionCommand.OutTol)==0: cmd.SetToggleString(3,165,0) else: cmd.SetToggleString(4,165,0) pc_dmis_report() dmispart.RefreshPart()