How increase size of parameter array in object instance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2017-12-08
08:19 PM
- last edited on
2022-12-06
01:47 PM
by
Daniel Kassai
But I have error where assign to .ind1 value more than size of array, defined on the lib part.
chgParam.ind1 = 5;
chgParam.realValue = 10;
err = ACAPI_Goodies (APIAny_ChangeAParameterID, &chgParam, NULL);
Can I increase size of the parameter array dynamicly, without changing a lib part?
Help me please...)
- Labels:
-
Add-On (C++)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2017-12-15 07:47 AM
May be it is possible.
But you can to change a parameter value array directtly:
1. Get the element memo of an object instance
ACAPI_Element_GetMemo, APIMemoMask_AddPars flag
2. Find the API_AddParType by parameter name in the memo.params handle
3. Reallocate "array" field of this API_AddParType structure
and assign valid dim1, dim2 fields
4. Update changes by the ACAPI_Element_ChangeMemo
PS:
If it is you own lib.part, also you can to try other trick.
( just idea, i am not sure it will work )
Add a special hidden parameter to this lib.part - "dimension size".
The GDL parameter script have to change the array size as this parameter.
Change this parameter by APIAny_ChangeAParameterID to resize the array by GDL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2017-12-21 04:01 PM
Tsepov wrote:I haven't tried using
I need to increase or resuce count of the items in parameters array.
But I have error where assign to .ind1 value more than size of array, defined on the lib part.
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-01-05 02:15 PM
Tsepov wrote:No, you can't change that, because the dimensions are defined in the library part itself, and here you want to modify that via a placed instance. So please define the max dimensions in the library part itself.
I need to increase or resuce count of the items in parameters array.
But I have error where assign to .ind1 value more than size of array, defined on the lib part.
chgParam.ind1 = 5;
chgParam.realValue = 10;
err = ACAPI_Goodies (APIAny_ChangeAParameterID, &chgParam, NULL);
Can I increase size of the parameter array dynamicly, without changing a lib part?
Help me please...)
Best, Ákos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-01-06 07:44 AM
I had to pre-set in the library element the maximum number of rows in the array and in another parameter to record the number of employees.
In principle, the idea works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-01-06 12:48 PM
Akos wrote:Library part instances can dynamically change the array bounds (for that instance) within the GDL script and we routinely do that via the API too. Changing the array bounds of the library part has no affect on placed instances, i.e. they retain their original content (unless the variable is no longer an array).
No, you can't change that, because the dimensions are defined in the library part itself, and here you want to modify that via a placed instance. So please define the max dimensions in the library part itself.
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-01-06 01:08 PM
I create a library element with the parameter my_array [2] [2]. Put into the project one and the second instance.
Then I open the second one, in the editor and manually change my_array [2] [3].
Save it.
As a result, the first Instance remains [2] [2] and the second [2] [3].
But to get access to write data from the API to the first one is no longer possible.
It gives an error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-01-06 02:05 PM
The idea is as follows:
GDL BIM element creator (anybody) can create objects whose area or volume figures is restored by coordinates from the parameter array by EXTRUDE or other GDL commands.
Now his users can use free addons, which takes the hatching and writes coordinates to this array.
The same addons can restore the shading from the array so that the GDL user of the element can change the form and write the changed form back to the element.
One of the GDL objects, that use this method is a frame with any form hard.
It not needed to save new library element for new form.
Simply the creator of the object's GDL must pre-set a sufficient number of rows in the coordinate array.
But control size of the array by API would be preferable.
Maybe there is some other way to write data to the GDL element for store coordinate array with variable length?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-01-08 12:51 PM
Tsepov wrote:You can dynamically change the size of an array in an object instance via both GDL and the API. But you need to read/write the parameter memo data for the object element to make this work.
Simply the creator of the object's GDL must pre-set a sufficient number of rows in the coordinate array.
But control size of the array by API would be preferable.
Maybe there is some other way to write data to the GDL element for store coordinate array with variable length?
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2022-08-03 09:52 PM
I'm trying to follow this but having a hard time with reallocating array field. Could you elaborate on this? Does the array need to be GSHandle type and how does one determine its size?