We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2015-03-25 01:36 PM - last edited on 2023-08-01 01:28 PM by Doreena Deng
2015-03-26 10:30 AM
bool GetIFCNameFromElementGuid (const API_Guid& element_guid, GS::UniString* ifcName) { GS::Array<API_IFCAttribute> attributes; ACAPI_Element_GetIFCAttributes (element_guid, &attributes); for (GS::Array<API_IFCAttribute>::ConstIterator it = attributes.Enumerate (); it != NULL; ++it) { if ((*it).attributeName == "Name") { *ifcName = (*it).attributeValue; return true; } } return false; } // Usage: GS::UniString ifcName; GetIFCNameFromElementGuid (element_guid, &ifcName);
2015-04-07 03:20 PM
2015-04-07 03:50 PM
New wrote:
How can it convert GS::UniString to string or char ?
GS::UniString gsUniString ("string_inside"); char* cString = gsUniString.ToCStr ().Get (); std::string str (gsUniString.ToCStr ()); // std::string str (gsUniString.ToCStr (0, GS::MaxUSize, CC_UTF8));
2015-04-08 09:15 AM
char* cString = gsUniString.ToCStr ().Get ();
char cString[32]; for (int ii=0;ii<32;ii++){ cString[ii] = *gsUniString.ToCStr (ii).Get (); }
std::string str (gsUniString.ToCStr ());
2015-04-08 10:30 AM
char* cString = gsUniString.ToCStr ().Get ();Found better solution simple just:
const char* cString = gsUniString.ToCStr().Get();And everythings works fine