We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2016-03-10 12:01 PM - last edited on 2023-07-13 02:22 PM by Doreena Deng
2016-03-10 04:48 PM
GS::UniString s = libpart.ownUnID; GS::Guid gs_guid(s); API_Guid ag = GSGuid2APIGuid (gs_guid);It seem's to work but i'm not sure it's the best method.
2016-03-10 05:13 PM
2016-03-10 07:09 PM
// Scan all selected objects in AC API_SelectionInfo selectionInfo; API_Neig **selNeigs; err = ACAPI_Selection_Get (&selectionInfo, &selNeigs, false); if (err == NoError) { // If we have selected elements if (selectionInfo.typeID != API_SelEmpty) { UInt32 ii, nSel; nSel = BMGetHandleSize ((GSHandle) selNeigs) / sizeof (API_Neig); for (ii = 0; ii < nSel && err == NoError; ii++) { // Get selected element API_Element element; BNZeroMemory (&element, sizeof (API_Element)); element.header.guid = (*selNeigs)[ii].guid; err = ACAPI_Element_Get(&element); if(err == NoError) { // Is it a library part API_LibPart libpart; BNZeroMemory (&libpart, sizeof (libpart)); libpart.index = element.object.libInd; err = ACAPI_LibPart_Get (&libpart); if (err == NoError) { // Yes it's a library part // Get elements guid API_Guid good_ag = element.header.guid; // Get Guids from the library part and NOT from selected element GS::UniString s = libpart.ownUnID; GS::Guid gs_guid(s); API_Guid bad_ag = GSGuid2APIGuid (gs_guid); GS::UniString s1 = libpart.parentUnID; GS::Guid gs_guid1(s1); API_Guid bad_ag1 = GSGuid2APIGuid (gs_guid1); DumpIFCProperties(libpart, good_ag);
2016-03-18 06:53 PM
gehairing wrote:Hi,
I have made a test function.
The functions gets the selected element in the model and get his API_Guid.
It also tries to get the GUID from the library part (if an library part is selected of course).
When I compare the Guid's...there are different.
Probably i am not understanding how all this works.
// Scan all selected objects in AC API_SelectionInfo selectionInfo; API_Neig **selNeigs; err = ACAPI_Selection_Get (&selectionInfo, &selNeigs, false); if (err == NoError) { // If we have selected elements if (selectionInfo.typeID != API_SelEmpty) { UInt32 ii, nSel; nSel = BMGetHandleSize ((GSHandle) selNeigs) / sizeof (API_Neig); for (ii = 0; ii < nSel && err == NoError; ii++) { // Get selected element API_Element element; BNZeroMemory (&element, sizeof (API_Element)); element.header.guid = (*selNeigs)[ii].guid; err = ACAPI_Element_Get(&element); if(err == NoError) { // Is it a library part API_LibPart libpart; BNZeroMemory (&libpart, sizeof (libpart)); libpart.index = element.object.libInd; err = ACAPI_LibPart_Get (&libpart); if (err == NoError) { // Yes it's a library part // Get elements guid API_Guid good_ag = element.header.guid; // Get Guids from the library part and NOT from selected element GS::UniString s = libpart.ownUnID; GS::Guid gs_guid(s); API_Guid bad_ag = GSGuid2APIGuid (gs_guid); GS::UniString s1 = libpart.parentUnID; GS::Guid gs_guid1(s1); API_Guid bad_ag1 = GSGuid2APIGuid (gs_guid1); DumpIFCProperties(libpart, good_ag);
2016-03-21 08:26 AM