cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum
GDL coding questions, Python and add-on development using the API Dev Kit.

n REQUEST for name of surface

Njegos T
Contributor

Hi everyone,

I need help how to write script to pull parameter for name of surface.

NjegosT_0-1646990199558.png

 

I've tryed with 
n = REQUEST ("Name_of_material", "c", mat) and result that is writen in label is "GENERAL" no metter which surface I set in object, so I tryed with
n= REQUEST ("ASSOCLP_PARVALUE_WITH_DESCRIPTION", "c", name_or_index, type, flags, dim1, dim2, mat) and result is number of surface "231". 

NjegosT_1-1646991035157.png

 

NjegosT_2-1646991322040.png

I anyone know hot to write code to get instead number "231" surface name "RAL 7032" I'd be very thankfull! 🙂




1 ACCEPTED SOLUTION
5 REPLIES 5

Barry Kelly
Moderator

n = REQUEST ("Name_of_material", 231, mat)

 

That should return the name of material index number 231  to the variable mat

 

Barry.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Or use ...

 

n = REQUEST ("Name_of_material", c, mat)

 

Without the quotes around c (your surface variable).

c is the index number so you already have that.

 

 

Barry.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Solution
Njegos T
Contributor

It work now. First I get the number of material
n= REQUEST ("ASSOCLP_PARVALUE_WITH_DESCRIPTION", "c", name_or_index, type, flags, dim1, dim2, matnum)
and then from number I got the name
n = REQUEST ("Name_of_material", matnum, mat)

Thanks a lot!!

But if you have the parameter c for your material, you already have the number.

So just use c without quotes.

 

Unless it is in the Master or Parameter script, then you have to do it as you stated with ASSOCLP_PARVALUE_WITH_DESCRIPTION

 

I always forget that.

 

Barry.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

This script is for label, so first I need to get value (number of surface) from object and then transform number to name of surface. If I use c without quotes result is "GENERAL" instead of name. 


Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!