Fast way to isolate one object in detail?

I’m making a script that creates layout views for many (tens to hundreds of) part objects with front/top/right/iso detail views for each, and I need to have the details show only the single desired object. I’m currently using this method to hide all other objects in each detail.

def isolate_in_detail(obj, detail):
	for rh_obj in sc.doc.Objects.GetEnumerator():
		if rh_obj.Id == obj: continue
		attributes = rh_obj.Attributes.Duplicate()
		attributes.AddHideInDetailOverride(detail)
		sc.doc.Objects.ModifyAttributes(rh_obj.Id, attributes, False)

This is pretty slow on large files (a second or two per detail, of which I may have hundreds). Is there a faster way?

You might need to disable redraw when that script runs