BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Can someone show me how to use and array for this task.

Anonymous
Not applicable
I am trying to create a custom library part that repeats a shape (cprism) in a pattern based on the overall user defined size. I can make the rows and column I need but I would like to give the option of allowing the material of each individual shape to be selected via a material array. Since the locations are based a loop that determines X and Y, I need to pull the material from the array in the loop. Does anyone have any idea's or a better approach?

Thanks in advance.

Brian
8 REPLIES 8
I'm not sure I'm following. The materials change from cprism to cprism? You would need a separate parameter array for the materials, since it's a different parameter type. (You couldn't have [1][1]=1', [2][1]=2', [3][1]='Brick')

Within the loop, you can refer to as many arrays as you want.
!! I assume you've defined the arrays.
FOR k=1 TO n
X1=points[1]
Y1=points[2]
MATERIAL mats
ADD X1, Y1, 0
CPRISM bla, bla, bla,
DEL 1
NEXT k
James Murray

Archicad 25 • Rill Architects • macOS • OnLand.info
Anonymous
Not applicable
James: Thanks for your response. All that I am trying to do is allow different material be selected from an array each time a routine passes through a loop. The material in the array needs to be user defined for each object created by the loop. Spacing of objects is already calculated by the code. I have purchased objects/library parts before that allow user to edit tables (or arrays) to change materials.

For example: My program places "Golf Tee" shaped items on a 1' x 1' grid. If the user inputs a grid that is 10' x 10', it will produce 100 TEEs. I would like to edit a material property to produce a user editable array (or table) of the 100 TEEs with the ability to designate the color of each individual TEE.
Hmm. You want 100 material parameters? Or even n^2 material parameters?

The 100 is feasible, you can use a parameter array, [10][10]. The n^2 is tough. The only way to offer all the materials to the user is in a parameter array, and I don't think those can be of indefinite dimension. You would have to set some sort of limit for n.

Then you would probably want a UI script to make it tolerable to have so many parameters.

Can I ask who would want to set n^2 materials? Maybe you could do a smaller set of mats and randomize them across all the parts. I've seen that done, would have to check into how...
James Murray

Archicad 25 • Rill Architects • macOS • OnLand.info
Rob
Graphisoft
Graphisoft
Brian,

bad news mate, you can't have a dynamic array as a part of UI.
What that means:
if you want to allow changing parameters as you are suggesting the particular parameter must be listed (defined) as an array parameter in the parameter list in order to use that in the UI script. As you may have noticed the parameter list does not allow you to define dynamic array (in other words any array variable has to have its limits in the parameter list). Therefore this limitation imposes maximum number of instances (so if you wanted to have 5000 golf tees you would have to define (manually) an array parameter with size of [5000] - I suppose, you would click yourself to death...)
::rk
Frank Beister
Advisor
You can define arrays ynamical, but only in one direction. You can increase the number of rows and cols, but not decrease.

Since AC8 you can create dynamical arrays in the script and you can expand parameter arrays of the parameter list by setting a value to one more dimension.

Candle with hair. RAM is not indefinite.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
LiHigh
Newcomer
I hope this will help.

-------------------------------------------
We need to add 2 parameters:
spa_max ---- Max. Spacing.
mat ----------- Materials array
-------------------------------------------


-------------------------------------------
!!!!! In Master Scripts

nx=CEIL(a/spa_max) !!number of repeating OBJ in x-direction
ny=CEIL(b/spa_max) !!number of repeating OBJ in y-direction

spacing_x=a/nx !!actual spacing in x-direction
spacing_y=b/ny !!actual spacing in y-direction

PARAMETERS mat[nx+1][ny+1]=0 !!To increase Array size
-------------------------------------------


-------------------------------------------
!!!!! In 3D Scripts

FOR i=1 to nx
FOR j=1 to ny
MATERIAL mat
ADD (i-1)*spacing_x, (j-1)*spacing_y, 0
PRISM_ 4,0.01,
0,0,15,
0,0.1,15,
0.1,0.1,15,
0.1,0,15
DEL 1
NEXT j
NEXT i
-------------------------------------------
Howard Phua

Win 10, Archicad 19 INT
Rob
Graphisoft
Graphisoft
oops, so I was wrong...
::rk
Anonymous
Not applicable
Thank you all so much. Using the scripts you provided I am able to create the part I need. Thanks again.

Brian
Learn and get certified!