cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Starting August 6, 2024, TLS 1.2 will be the minimum required protocol version for Graphisoft products and services that require an online connection. License Manager Tool update is required on Windows. Learn more…
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

String Arrays

Anonymous
Not applicable
I have programmed some objects in previous versions of AC and didn't have this problem before.

I wanted to create an array that a user could use to input some 3 character variables.

If I dimension the variable (I.e., DIM wlunit [10][10] or even DIM wlunit [][] in the Master Script, the user cannot enter any values. In the past, I was able to initialize the array in the Master script and then the user would be allowed to change the values. Now I cannot initialize the array or dimension it.

A part created in AC9 (or was it AC8 that was then saved in AC9) with an array. It has an initialized array and I can change the parameters later in the object setting dialog box.

Is there a correct way to do it? It would be nice to be able to initialize my array.
16 REPLIES 16
Anonymous
Not applicable
Phill,
This may be way off base but, have you declared
the array once in the parameter list and then
the same array again in the master script ?
David Nicholson-Cole discovered that this
worked in versions prior to AC 8.0 but
did not work from 8.0 onward.
You declare and initialize the array once
in the parameter list and the user can change the values.

Sorry if this has nothing to do with your issue.
Peter Devlin
Anonymous
Not applicable
Peter,
Thanks for the suggestion. I think you did help me on one thing because I thought about using a dynamic array (correct term?) with an unspecified size but then the array didn't show up in the parameter list and therefore there wasn't any way for the user to enter any information. I added the array in the parameter list and then discovered I had to eliminate the DIM statement.

If I declare the array in the parameter list, how do I initialize the array? I will try a few things.

I may post something to gdl-talk if I can find the link.

Thanks again
Anonymous
Not applicable
You can assign values to the array with the PARAMETERS statement.

I often use a FOR loop such as:

FOR i = 1 TO whatever
PARAMETERS array_1 = something
NEXT i

Naturally you have to enclose this in some conditional statement (with GLOB_MODPAR_NAME or such) or it will constantly override any user input.
Anonymous
Not applicable
Matthew,

Thanks for the hint. I have never used the GLOBAL_MODPAR_NAME in the past except to tinker but I understand the concept and will try that.

Thanks.
Anonymous
Not applicable
Phil,
The way you initialize a parameter list array is the following.
Select the variable type in the usual way (length, pen, text, etc).
Push the array icon button and the array opens but it is a one
dimensional array with one row and one column.
To get more than one row select the row number
which is initially 1 and then push the "insert" button
at the bottom of the dialog as many time as needed.
To get more columns, select the first column number and
press the "insert" button and more columns will be created.
After you have opened the array dialog for the first time
the only way you can open it again is to use the "Set" button
which comes available if you click on the parameter.
After you have set up your rows and columns you
can initialize the values you want.
Peter Devlin
Anonymous
Not applicable
Thanks for responding Peter.

I had created the array as you described but perhaps I am not making myself clear. Assuming I have created a 10x10 array in the parameters list and want to initialize all of the values to "" (null) inside the GDL object.

If I use a FOR/NEXT loop to initialize the array, the user is not able to change the values in the object properties dialog box. I guess I need to use the GLOB_MODPAR_NAME in a conditional statement? I didn't have to do this in the past but...

Regards
Phil
Anonymous
Not applicable
Phil,
I was just playing around with the array parameter
and after the rows and columns are created all
of the values are "null" or blank by default.
As far as I can tell this does not change until
you or the user fills in the cells with characters.
I will check again.
Thanks,
Peter Devlin
Anonymous
Not applicable
I agree that the array gets created as nulls but in the process of testing my part, values get put into the array. I was hoping I could use a FOR/NEXT loop to empty them out but still have the user input their values later.

As I said it worked in previous versions of AC and doesn't now so I just want to know if there is a way to do it properly.

Phil
Anonymous
Not applicable
Phil,
I just checked again and indeed all the cells created
when I make the rows and columns I want are blank by default.
I saved the object, inserted an instance in the plan, selected it,
opened the settings dialog, and opened the array parameter
dialog and all the cells were blank.
I inserted some characters in a few of the blank cells, hit OK
and returned to the plan. I selected the object again
and opened it's setting dialog and checked to see
if the changes I made had held. They did.
I am sorry. I am clearly missing something.
Thanks,
Peter Devlin