Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

GSHandle to structure [SOLVED]

ReignBough
Booster
I have a structure and I saved it on attribute user data using:

API_AttributeUserData user_data;
user_data.dataVersion = MY_ATTS_VERS;
user_data.platformSign = GS::Win_Platform_Sign;
user_data.dataHdl = BMAllocateHandle(sizeof(MyUserData), ALLOCATE_CLEAR, 0);
GSErr ud_err = BMPtrToHandle(&UserData, &user_data.dataHdl, sizeof(MyUserData));
ACAPI_Attribute_SetUserData(&UDHead, &user_data);
UserData is the user data to be saved, and UDHead has the typeID and index.

When I use ACAPI_Attribute_GetUserData(), I am able to get the version and platform sign. But I am lost in retrieving the saved user data.

Help anyone?

>> ArchiCAD 17
~ReignBough~
ARCHICAD 24 INT 4018 FULL (from AC18)
Windows 10 Pro, Intel Core i7-4790 CPU @ 3.60GHz, 32.0GB RAM, 64-bit OS
2 REPLIES 2

Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

I think it should work this way:
err = ACAPI_Attribute_GetUserData (&attribute.header, &userData); 
if (err == NoError) { 
	MyUserData** myUserData = reinterpret_cast<MyUserData**> userData.dataHdl; 
	// now you can use the userdata 
	// after working with it, don't forget to free the handle! 
	BMKillHandle (&(userData.dataHdl)); 
} else { 
	ACAPI_WriteReport ("Error: ACAPI_Attribute_GetUserData", false); 
}


Regards,
Tibor

ReignBough
Booster
Thanks Tibor.
~ReignBough~
ARCHICAD 24 INT 4018 FULL (from AC18)
Windows 10 Pro, Intel Core i7-4790 CPU @ 3.60GHz, 32.0GB RAM, 64-bit OS

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!