here is a cleaner xray toggle. import pymel.core as pmdef xraytoggle(): sel = pm.ls(sl=True, dag=True, ap=True, typ='surfaceShape') hilighted = pm.ls(hl=True, dag=True, ap=True, typ='surfaceShape') for i in hilighted: value = pm.displaySurface(i, q=True, xRay=True) if value[0]: pm.displaySurface(i, xRay=False) else:…