GDL
About building parametric objects with GDL.

Building Material list - alphabetical order

Anonymous
Not applicable
Dear all,

I would like to create custom list (like fill list from AC24 library) with building material names and fills. My problem is, that I can request the building material infos, put them in an array, but it's order based on the building material's index. I would like to list them based on the IDs alphabetically.

Is there any way to organise or list the array so I could use it in alphabetical order?

Thx,
2 REPLIES 2
kuvbur
Enthusiast
REQUEST ("Name_of_material" not work in parameter script, then only way is read txt file stored material name.

Structural engineer, developer of free addon for sync GDL param and properties

kuvbur
Enthusiast
Thought you mean using a list in Values. To display a list of materials on the plan, you can do this
!!!------------------ SORT ---------------------
dim mat_inx[][]
name = "" : id = "" : _fillType = 0 : _fillPen = 0 : _fillBgPen = 0
n_material = 0
for index=0 to 1000
	n = REQUEST ("Name_of_material", index, name)
	if n then
		n = REQUEST{2} ("Building_Material_info", index, "gs_bmat_id", id)
		n = REQUEST{2} ("Building_Material_info", index, "gs_bmat_cutfill_properties", _fillType, _fillPen, _fillBgPen)
		n_material = n_material + 1
		mat_inx[n_material][1] = index
		mat_inx[n_material][2] = name
		mat_inx[n_material][3] = id

		mat_inx[n_material][4] = _fillType
		mat_inx[n_material][5] = _fillPen
		mat_inx[n_material][6] = _fillBgPen
	endif
next index

for n = 1 to n_material
	for m = n to n_material
		if mat_inx[sort_col] > mat_inx[sort_col] then
			for k=1 to vardim2(mat_inx)
				_temp = mat_inx
				mat_inx = mat_inx
				mat_inx = _temp
			next k
		endif
	next m
next n
!!!------------------ SORT ---------------------
sort_col = 2 for sort by ID

Structural engineer, developer of free addon for sync GDL param and properties