Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Reinstating materials

Anonymous
Not applicable
I wonder if any of the GDL gurus out there can help me with this problem?

In an object I am making I want the user to be able to set all the objects in an array to be either the same, or for the materials to alternate thus item 1 to be material 1, item 2 material 2; item3 material 1;item4 material2 and so on.

I have tried the following:

IF modpar='samemat' THEN
FOR P=1 TO num
IF samemat=1 THEN
holdmat

=mat2


mat2

=mat1


ELSE
mat2

=holdmat


ENDIF
NEXT P
ENDIF

In the above modpar is a variable derived from 'GLOB_MODPAR_NAME'. samemat is an on/off parameter where the user chooses whether all the objects are the same material or whether the components have alternating materials. There may be more that one array, but only two possible materials in each of the arrays. All the arrays are correctly declared and defined in the object

The intent of the script steps above is as follows: if the material is to be the same throughout, make all the materials the same, and place the second material in a 'holding array'. If the materials are to differ then retrieve the stored data from hold mat and use it as the second material.

I have tried this in the Master script, and in the Parameters script (with the addition of a PARAMETERS directive where necessary). The result from the Parameter script is not good, so I have been trying to make this work in the Master script. The result from the Master script is that the materials change in the UI that I have created, but the materials in the object itself do not update. In fact the model seems to think that all elements in the mat2

array are the 'General' material.

It works in one direction: i.e when materials differ and are changed to become the same, the process works, but when changing from one material to two, the process doesn't work.

I can only deduce that the Master script is telling the UI that the materials have been updated, but the 3D script is ignorant of this change.

Mike

2 REPLIES 2
Frank Beister
Moderator
I don't understand, why you use an array to store the materials.

You want to make the matrial of the objects individual or equal. Choosable by one switch, right?
! ### 3D-Script:
FOR P=1 TO num

IF samemat=1 THEN
  SET MATERIAL mat1

! or simply ! SET MATERIAL mat1 ! if there's only one material for all ELSE SET MATERIAL mat2

ENDIF ! here come the objects defining statements, CALLs etc. NEXT P

If you don't want to see the individual materials in the UI or parameter list you can hide them by the same IF ... THEN construction and additional LOCK and HIDEPARAMETER.
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
Anonymous
Not applicable
F Beister solved it for me. When I thought about it the answer was just too obvious - I feel as if I am really dumb!! Many thanks for the input - I might have got there eventually but I was not thinking about how to solve the problem in the right way!!