Find the next step in your career as a Graphisoft Certified BIM Manager!

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Get building material name from ID

Kaj_AL
Booster

Hi everyone!

 

In my GDL object Properties script, I have building material and material information that I would like to translate from Index to Name.

 

For example, I have a building material with index 97 and the name Offices. In my lists, I use the building material as a unit. Right now, I have written

IF bui_mat=97 THEN program="Offices"

which obviously isn't the best way to do it (and is prone to mistakes), but I just can't figure out how to do it. I've tried following guides with different REQUEST codes, but I'm doing something wrong. How do I do this?

 

Thank you!

/Kaj

Archicad 24-27 SWE
Dell Precision 5560, Windows 11 Pro
11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz 2.61 GHz
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Barry Kelly
Moderator

n = REQUEST ("Name_of_building_material", index, name)
Returns in the variable the building material name identified by index.

 

This should work for you.

You add the index number and it will tell you the name in the 'name' variable.

 

So in your case...

n = REQUEST ("Name_of_building_material", 97, name)

PRINT name (or do what ever else it is you want to do with 'name'.

 

 

Barry.

 

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

View solution in original post

2 REPLIES 2
Solution
Barry Kelly
Moderator

n = REQUEST ("Name_of_building_material", index, name)
Returns in the variable the building material name identified by index.

 

This should work for you.

You add the index number and it will tell you the name in the 'name' variable.

 

So in your case...

n = REQUEST ("Name_of_building_material", 97, name)

PRINT name (or do what ever else it is you want to do with 'name'.

 

 

Barry.

 

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

So close to what I did, but so far! Thanks, works great!

Archicad 24-27 SWE
Dell Precision 5560, Windows 11 Pro
11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz 2.61 GHz

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!