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
Phil,
I just read your last post.
I think I now know what your getting at.
You want to have some sort of "re-set" function.
We will have to think about that one.
Peter Devlin
LiHigh
Newcomer
Phil,
I think that a bigger picture of what you are trying to achieve with your object will help us understand your problem better.
Howard Phua

Win 10, Archicad 19 INT
Anonymous
Not applicable
pfeinberg wrote:
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
If all you want to do is reset the values to defaults after editing, just run the FOR/NEXT loop and then comment the code before saving. You can also use this to create initial non-zero values. In fact, I find this easier than entering the values manually in the parameters list (seriously bad interface IMHO).

The user can always reset all the parameters to defaults by switching to another part and back, so all the IF/THEN and GLOB_MODPAR_NAME tricks are only needed for a partial reset or to reinitialize for changed conditions.
LiHigh
Newcomer
Reset is very easy to implement.

create a parameter says "reset_all".

!-----------------script--------------------

IF reset_all THEN

FOR i=1 TO VARDIM1(array)
FOR j=1 TO VARDIM2(array)
PARAMETERS array="Whatever Values"
NEXT i
NEXT j
PARAMETERS reset_all=0

ENDIF
!------------------------------------------

Hope this help!
Howard Phua

Win 10, Archicad 19 INT
Anonymous
Not applicable
If you want to create an initiallization part do the following.
Create a variable named for example trigger.

In the master script have a simple code line such as (not gdl code but metacode)

If (trigger = true ) then trigger=false
Else trigger=true

That way you trigger the GLOB_MODPAR_NAME to be set to trigger

then using the GLOB_MODPAR_NAME in the parameters section you can create a code to handle when the trigger parameter changes. Put there all the initialisation code. Simple as that.
Anonymous
Not applicable
oreopoulos wrote:
If (trigger = true ) then trigger=false
Else trigger=true
This sounds like the liar's paradox (from ancient Greece as I recall)
Anonymous
Not applicable
Not exacly

This is executed once and just changes the state of the boolean variable.

The paradox you talk goes like this: (the zinon paradox)

I am a man and i always tell the truth and i say i am lying.

This is a paradox caused by selfreferenced sentenced. Such logical sentences are not valid in mathematical first order logic.

But ofcourse the code above has nothing to do with that