Page 1 of 1

Problems Assigning Rooms to Groups

Posted: Tue Jun 04, 2019 9:57 am
by izzylys
Hello,

I'm having some trouble using the RoomGroups functionality and was wondering if someone could point out what I'm doing wrong. I'm trying to assign a list of rooms to a group, but keep getting a ValueError: No group exists with the specified index even though I'm getting the index by calling get_room_groups(). Here is a simplified version of what I'm running:

Code: Select all

rg = iesve.RoomGroups()
bodies = iesve.VEProject.get_current_project().models[0].get_bodies(False)

groups = {
	'Group 1': bodies[:12],
	'Group 2': bodies[13:22],
}

scheme = 10
room_groups = {g['name']: g['handle'] for g in rg.get_room_groups(scheme)}

for group_name, room_list in groups.items():
	print('Assigning the following group:')
	print('group handle: {}, scheme handle: {}, rooms: {}'.format(
		room_groups[group_name], scheme, room_list))
	rg.assign_rooms_to_group(room_groups[group_name], scheme, room_list)

The print line outputs the following:

Code: Select all

Assigning the following group:
group handle: 1, scheme handle: 10, rooms: [<iesve.VEBody object at 0x2798FD30>, .....]
Upon running, I get the following error:
rg.assign_rooms_to_group(room_groups[group_name], scheme, room_list)
ValueError: No group exists with the specified index


Any help on this would be greatly appreciated!

Re: Problems Assigning Rooms to Groups

Posted: Tue Jun 04, 2019 11:27 am
by Rhind
Looks like you have the scheme index and the group index the wrong way round. The documentation currently has them listed in the wrong order.

Re: Problems Assigning Rooms to Groups

Posted: Thu Jun 06, 2019 8:13 am
by izzylys
Haha that's an hour of my life I'll never get back :lol:

Thanks a lot Rhind! Looks like it's all working fine now. Are there any plans to update the API docs in the near future?

Re: Problems Assigning Rooms to Groups

Posted: Thu Jun 06, 2019 9:36 am
by Rhind
It will get corrected in future but I don't know precisely when.