Try this import maya.cmds as cmds
import maya.mel as mel #Get all the transform nodes that have hg in it's name
geo_list = cmds.ls('*hg*',type='transform') #run through all the geometry
for geo in geo_list: #Ch=0 so that the soft edge won't end up in history cmds.polySoftEdge(geo,a=180,ch=0) #Get shapes to assign material…