We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2015-02-20 09:18 AM - last edited on 2023-08-01 01:38 PM by Doreena Deng
Solved! Go to Solution.
2015-03-05 11:15 AM
New wrote:If you look at the structure of
As i understand getParams.params is a list of all the rest parameters how do i choose one of them ?
API_AddParType **params;This means that params is a handle, or a pointer to a pointer. You could get the first parameter by simply dereferencing the handle twice, e.g.
API_AddParType firstParameter = **getParams.params;But what you really want to do is access all the values. The easiest approach is to dereference the handle once and then treat the resulting pointer as an array, so the first parameter could also be expressed like this:
API_AddParType firstParameter = (*getParams.params)[0];The nth parameter could be accessed like this:
API_AddParType nthParameter = (*getParams.params)To determine how many parameters the handle contains, you want to divide the total amount of memory allocated to the handle by the size of a single parameter:;
GSSize parameterCount = BMGetHandleSize(getParams.params) / sizeof(API_AddParType);
2015-02-20 12:46 PM
New wrote:
Could i get parameters using ACAPI_Element_Select.
F.e. get parameters from selected object and use these parameters for other object. I need hight, width, lenght, and position, probably sym_pos, or is there other way to get position?
2015-02-20 01:14 PM
2015-03-03 03:21 PM
2015-03-05 08:51 AM
BNZeroMemory (&getParams, sizeof (API_GetParamsType)); err = ACAPI_Goodies (APIAny_GetActParametersID, &getParams, NULL); if (err == NoError) { BNZeroMemory (&element, sizeof (API_Element)); BNZeroMemory (&memo, sizeof (API_ElementMemo)); element.header.typeID = API_ObjectID; element.header.index = selectedInd; ACAPI_ELEMENT_MASK_CLEAR (mask); memo.params = getParams.params;
2015-03-05 11:15 AM
New wrote:If you look at the structure of
As i understand getParams.params is a list of all the rest parameters how do i choose one of them ?
API_AddParType **params;This means that params is a handle, or a pointer to a pointer. You could get the first parameter by simply dereferencing the handle twice, e.g.
API_AddParType firstParameter = **getParams.params;But what you really want to do is access all the values. The easiest approach is to dereference the handle once and then treat the resulting pointer as an array, so the first parameter could also be expressed like this:
API_AddParType firstParameter = (*getParams.params)[0];The nth parameter could be accessed like this:
API_AddParType nthParameter = (*getParams.params)To determine how many parameters the handle contains, you want to divide the total amount of memory allocated to the handle by the size of a single parameter:;
GSSize parameterCount = BMGetHandleSize(getParams.params) / sizeof(API_AddParType);
2015-03-05 11:22 AM
2018-11-20 12:26 AM
Ralph wrote:I have tried this part and got error:
GSSize parameterCount = BMGetHandleSize(getParams.params) / sizeof(API_AddParType);
2018-11-20 09:54 AM
kzaremba wrote:The compiler only sees 2 different types that have no defined conversion. In this case we know they are actually the same thing, so the simplest solution (given that this part of the API is C) is to use a C-style cast:Ralph wrote:I have tried this part and got error:
GSSize parameterCount = BMGetHandleSize(getParams.params) / sizeof(API_AddParType);
API_AddParType is not valid with GS::GSConstHandle
GSSize parameterCount = BMGetHandleSize((GS::GSConstHandle) getParams.params) / sizeof(API_AddParType);I wouldn't recommend that approach for C++, but the technique still exists for bridging to C in situations like this.
2018-11-20 09:59 PM
Ralph wrote:I see mysteries of C... Thanks a lot it's working!
C in situations