Problems Assigning Rooms to Groups

The VE Python API allows users create simple programs using the Python Programming Language, to interact with a VE Model and/or Vista Results File
Post Reply
izzylys
VE Newbie
VE Newbie
Posts: 7
Joined: Fri May 03, 2019 3:45 pm

Problems Assigning Rooms to Groups

Post 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!
User avatar
Rhind
IES Staff
IES Staff
Posts: 87
Joined: Fri Mar 22, 2013 5:06 pm

Re: Problems Assigning Rooms to Groups

Post 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.
izzylys
VE Newbie
VE Newbie
Posts: 7
Joined: Fri May 03, 2019 3:45 pm

Re: Problems Assigning Rooms to Groups

Post 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?
User avatar
Rhind
IES Staff
IES Staff
Posts: 87
Joined: Fri Mar 22, 2013 5:06 pm

Re: Problems Assigning Rooms to Groups

Post by Rhind »

It will get corrected in future but I don't know precisely when.
Post Reply