2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2022-06-18
04:38 PM
- last edited on
2023-09-07
11:06 PM
by
Daniel Kassai
Hello,
I can successfully modify items in an array parameter of a Library (GDL) object using the approach described here APIAny_OpenParametersID.
Since API_ChangeParamType takes an "ind1" and "ind2" its quite straightforward to do so.
Now how do i go about appending items to the array, or maybe completely replace the array with new values? If ind1 or ind2 is out of bounds i will get an error.
According to API_AddParType:
For parameters with array modifier, you can change the dimensions of the array on the fly when you create or modify an element. This enables you to put just a placeholder for an array into the library part parameter, and adjust that when you actually place the library part.
Does this mean you can change dim1 and dim2 in the API_AddParType struct directly?
But at the same time it is discouraged to modify API_AddParType (taken from APIAny_OpenParametersID):
The only way to ensure full parameter consistency while changing a value of a Library Part parameter is to use the functions provided for this operation. If you manipulate the API_AddParType handle directly, the parameter list may become invalid.
and from API_AddParType:
It is strongly advised to use the APIAny_OpenParametersID, APIAny_ChangeAParameterID, APIAny_GetActParametersID, APIAny_CloseParametersID functions to modify a parameter in the parameter list.
What is the recommended/safe/standard way to append items / resize a GDL array parameter from the C++ side then?
Thanks
Solved! Go to Solution.
2022-06-18 04:53 PM - edited 2022-06-18 05:05 PM
Alright, in the section about API_AddParType under remarks, it says:
For parameters with array modifier, you can change the dimensions of the array on the fly when you create or modify an element.
Do they mean that i can change dim1 and dim2 in API_AddParType to the desired size and then set the item? But I interpret the docs as modyfing API_AddParType directly is an incorrect approach:
If you manipulate the API_AddParType handle directly, the parameter list may become invalid.
AND
It is strongly advised to use the APIAny_OpenParametersID, APIAny_ChangeAParameterID, APIAny_GetActParametersID, APIAny_CloseParametersID functions to modify a parameter in the parameter list.
So what is the recommended approach to appending items / resizing a GDL array from C++ then? I am getting a feeling from the docs that API_AddParType should not be modified directly.
2022-06-18 04:53 PM - edited 2022-06-18 05:05 PM
Alright, in the section about API_AddParType under remarks, it says:
For parameters with array modifier, you can change the dimensions of the array on the fly when you create or modify an element.
Do they mean that i can change dim1 and dim2 in API_AddParType to the desired size and then set the item? But I interpret the docs as modyfing API_AddParType directly is an incorrect approach:
If you manipulate the API_AddParType handle directly, the parameter list may become invalid.
AND
It is strongly advised to use the APIAny_OpenParametersID, APIAny_ChangeAParameterID, APIAny_GetActParametersID, APIAny_CloseParametersID functions to modify a parameter in the parameter list.
So what is the recommended approach to appending items / resizing a GDL array from C++ then? I am getting a feeling from the docs that API_AddParType should not be modified directly.