[SOLVED] Parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2015-02-20
09:18 AM
- last edited on
2023-08-01
01:38 PM
by
Doreena Deng
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?
I hope this makes sense.
Solved! Go to Solution.
- Labels:
-
Add-On (C++)
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
The parameters do not contain the object position. You need to retrieve the other element settings through
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2015-02-20 01:14 PM
Will try to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2015-03-03 03:21 PM
API_AddParType and call parameter index ? or i could call by parameter name ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2015-03-05 08:51 AM
I belive this would be right approach but not sure how to go further...
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2015-03-05 11:22 AM
I think i got it now, thanks.
Will get right on it

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-11-20 12:26 AM
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
Why ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-11-20 09:59 PM
Ralph wrote:I see mysteries of C...
C in situations

Why it used to work without casting before ?