Got a minute? We appreciate your feedback:

Graphisoft Learn survey
About building parametric objects with GDL.

Building Material list - alphabetical order

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?


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

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
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
	next m
next n
!!!------------------ SORT ---------------------
sort_col = 2 for sort by ID

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

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!