to be used in the Script Console for example and print all Equipment under a specific Site

Step-by-step guide

try this script

sitePath = "[global]\\<Enterprise>\\<Site>" # replace with your Enterprise\Site

def get_all_children(obj, obj_list=[]):
	"""
		Gets all children of a given object
		:param obj: An MES object for which you want to retrieve children
		:type obj: mes_classes.AbstractMESObject
		:param obj_list: A list of dictionaries built thus far. This is autogenerated by the script and should not be manually added.
		:type obj_list: list
		:return: A final list of dictionaries that include: 'obj': the object itself, 'name': the name of the object, 'path': the path from the parent to the child
		:rtype: list[dict]
	"""
	child_objs = [child.getMESObject() for child in obj.getChildCollection().getList()]
	for child in child_objs:
		obj_list.append(child)
		if child.getChildCollection().getList():
			get_all_children(child, obj_list)
	return obj_list
	
site_obj = system.mes.loadMESObjectByEquipmentPath(sitePath)

for eq in get_all_children(site_obj, []):
	print eq.getEquipmentPath()



system.mes.object