Yeah, I was originally going to but it started giving me trouble about it being HTML so I resorted to screenshots.
Thanks for the link though.
Here's the working code snippet:
def set_visibility_range(lyr, min_threshold, max_threshold):
if lyr.isFeatureLayer:
lyr.visible = True
lyr.minThreshold = min_threshold
lyr.maxThreshold = max_threshold
else:
print(f"'{lyr.name}' does not support scale ranges")
for lyr in m.listLayers():
if "Primary" in lyr.name:
set_visibility_range(lyr, 300000, 0)
elif "Secondary" in lyr.name:
set_visibility_range(lyr, 2500, 0)
elif "Pole" in lyr.name and "Anno" not in lyr.name:
set_visibility_range(lyr, 5000, 0)
elif "Anno" in lyr.name:
set_visibility_range(lyr, 2500, 0)
else:
set_visibility_range(lyr, 0, 0)
aprx.save()
print("FC visibility ranges set...")