Author:Regina Judak
Posted: Thu Jan 05, 2017 5:40 pm (GMT+1)
Hi,
With the help of the API_DoorRelation you can obtain the API_Guid of the rooms that are connected to the door, and from the element info of the door you can get the owner wall's API_Guid. From the API_Guids you can get the room (zone) names, number and the wall's composite and thickness. The name of the parameter which describes the hinge side is "ac_openingSide".
For example if you want to know the information of the door you clicked on:
Regards,
Regina
Posted: Thu Jan 05, 2017 5:40 pm (GMT+1)
Hi,
With the help of the API_DoorRelation you can obtain the API_Guid of the rooms that are connected to the door, and from the element info of the door you can get the owner wall's API_Guid. From the API_Guids you can get the room (zone) names, number and the wall's composite and thickness. The name of the parameter which describes the hinge side is "ac_openingSide".
For example if you want to know the information of the door you clicked on:
Code: |
void ClickedDoorInfo (void) { API_Element element; API_DoorRelation doorInfo; BNZeroMemory (&element, sizeof (API_Element)); if (!ClickAnElem ("Click a door", API_DoorID, nullptr, &element.header.typeID, &element.header.guid)) { WriteReport_Alert ("No door was clicked"); return; } GSErrCode err = ACAPI_Element_Get (&element); if (err != NoError) { ErrorBeep ("ACAPI_Element_Get (door)", err); return; } err = ACAPI_Element_GetRelations (element.header.guid, API_ZombieElemID, &doorInfo); if (err != NoError) { ErrorBeep ("ACAPI_Element_GetRelations (door, all data)", err); return; } API_Element wallElement, fromRoomElement, toRoomElement; // Get the information about the owner wall ----------------------- WriteReport ("Owner wall: %s", APIGuidToString (element.door.owner).ToCStr ().Get ()); wallElement.header.guid = element.door.owner; if (ACAPI_Element_Get (&wallElement) == NoError) { WriteReport (" wall composite: %d", wallElement.wall.composite); WriteReport (" wall thickness at the beginning: %f", wallElement.wall.thickness); WriteReport (" wall thickness at the end: %f", wallElement.wall.thickness1); } // Get the information about the rooms ----------------------- WriteReport ("Connected rooms:"); WriteReport (" fromRoom: %s", APIGuidToString (doorInfo.fromRoom).ToCStr ().Get ()); WriteReport (" toRoom : %s", APIGuidToString (doorInfo.toRoom).ToCStr ().Get ()); fromRoomElement.header.guid = doorInfo.fromRoom; toRoomElement.header.guid = doorInfo.toRoom; if (ACAPI_Element_Get (&fromRoomElement) == NoError) { WriteReport (" fromRoom name: %s", GS::UniString (fromRoomElement.zone.roomName).ToCStr ().Get ()); WriteReport (" fromRoom number: %s", GS::UniString (fromRoomElement.zone.roomNoStr ).ToCStr ().Get ()); } if (ACAPI_Element_Get (&toRoomElement) == NoError) { WriteReport (" toRoom name: %s", GS::UniString (toRoomElement.zone.roomName).ToCStr ().Get ()); WriteReport (" toRoom number: %s", GS::UniString (toRoomElement.zone.roomNoStr ).ToCStr ().Get ()); } // Get the value of the ac_openingSide parameter ----------------------- API_ElementMemo memo; if (ACAPI_Element_GetMemo (element.header.guid, &memo) == NoError) { API_AddParType **params = memo.params; Int32 n = BMGetHandleSize ((GSHandle) params) / sizeof (API_AddParType); for (int i = 0; i < n; i++) { if (CHEqualASCII ((*params)[i].name, "ac_openingSide", CS_CaseInsensitive)) { WriteReport ("ac_openingSide: %s", (*params)[i].value.uStr); break; } } ACAPI_DisposeElemMemoHdls (&memo); } return; } |
Regards,
Regina