The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Topics specific to the scripting and development of Library Parts and Libraries using Param-O or the Geometric Description Language – GDL. (Example: How do you use “REQUEST” GDL commands?)

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, Gordana Radonic, nbalogh, mnguyen, gkmethy, rmasaki, Akos Somorjai, Csilla Mai, Peter Baksa

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?

Thought you mean using a list in Values. To display a list of materials on the plan, you can do this
Code: Select all
!!!------------------ 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[n][sort_col] > mat_inx[m][sort_col] then
			for k=1 to vardim2(mat_inx)
				_temp = mat_inx[n][k]
				mat_inx[n][k] = mat_inx[m][k]
				mat_inx[m][k] = _temp
			next k
	next m
next n
!!!------------------ SORT ---------------------
sort_col = 2 for sort by ID
(97.57 KiB) Downloaded 1 time
Снимок.PNG (23.43 KiB) Viewed 59 times