Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

GDL - Include the name of a surface in the parameters of an object

pedrocollares
Contributor

Hi all. I'm new to GDL subjects and I wonder if something I want to do is possible to achieve.

 

I need to create a 2D object that contain texts that come out of a surface parameter of my GDL object. Surface parameters in GDL I assume that mean only a surface index, and I couldn't find a way to "Get" the surface whole name and make a text out of it.

 

Surface names in my project follow this convention: "01 | WALL | BOARD FORMED CONCRETE WALL". I want to create a GDL object that contain such surface parameter and is able to print out substrings of that text, in that case "01" and "BOARD FORMED CONCRETE WALL". It should look something like this:

pedrocollares_0-1631064871366.png

If anyone is able to give me some directions, I'd be very thankful! 😊

1 ACCEPTED SOLUTION

Solution
n = REQUEST ("Name_of_material", superficie_1, surface_name)

 

AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

View solution in original post

11 REPLIES 11

Lingwisyer
Virtuoso

You will need to use the Split command to isolate the material number from it's name. In order to do this you will probably want to use the STRSTR command to get the position of your dividers which can then be inserted into Split as %n. You can then insert these new paramters into seperate Text2 commands.

 

 

Ling.

AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Lingwisyer, thank you for the tips. That does handle the part of splitting the string.

 

Although, I still don't have much of a clue on how to put out a TEXT2 command using the 'name' of a certain surface. I want this GDL object to print out names of surfaces that exist in the project. Having a text parameter would involve manually entering/updating such names.

 

pedrocollares_0-1631106611548.png

 

Seems to me the surface parameter consists only of the surface index. Can I use that name of the surface as a string inside the object?

 

Thanks in advance! 🙂

Lingwisyer
Virtuoso

If you are wanting your label to associate to some entity in your model, you will need to use a Request to find out the out the type of entity then from that check for Surface Overrides and if those are off, a Request for the bmat. 

 

There was a post following these lines somewhere around here, but the forum change has made some things difficult to find...

 

See these threads:

https://community.graphisoft.com/t5/Developer-forum/Is-there-a-way-to-request-a-building-material-na...

https://community.graphisoft.com/t5/Document-Visualize-forum/Smart-surface-tagging-Openings-Objects-...

 

 

 

Ling.

AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

pedrocollares
Contributor

Thanks again for your reply Lingwisyer! I'll try to explain with more detail what I'm trying to achieve. I'm editing a GDL object that has surface parameters associated to it.

 

pedrocollares_0-1631652298812.png

 

That surface associated to it should have a name that follows this convention:

 

<INDEX OF SURFACE> | <SURFACE CATEGORY> | < DESCRIPTION OF SURFACE>

 

Generic example: "02 | WALL | CONCRETE"

 

I wonder how can I bring the name of a surface parameter of the object itself to a TEXT2, which will be split in parts as you mentioned above. I want that text information to update as I update the surface parameter of that object.

 

Is there a way to do such thing?

 

Thanks in advance!

 

Lingwisyer
Virtuoso

Right. I think you will need to feed Request with your Surface 1 parameter to retrieve the surface name. to You can use the commands in my first post against this new result.

 

 

n = REQUEST ("Name_of_material", superficie_1, surface_name)

 

 

 

 

Ling.

AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

pedrocollares
Contributor

Lingwisyer, I suppose I'm almost there! What I managed so far:

 

pedrocollares_1-1632105736947.png

 

My object has a surface parameter assigned to it called "Sup_Param"

Then I want to 'Request' the surface name information from that surface to print it to a TEXT2, but I didn't find such a parameter available at the Material_info section:

 

pedrocollares_2-1632105992643.png

 

I was able to print out the texture name used in that surface, using the "gs_mat_texture", with the following:

 

pedrocollares_0-1632105698912.png

 

And achieving this result:

 

pedrocollares_3-1632106138274.png

 

This text is associated with the texture name, and that's already something. But I'd like it to associate to the surface name instead. Anything very basic I'm missing?

 

Thanks a bunch! 🙂

 

P.D.: From what I understood, Surfaces are named as "Material", or "gs-mat" in the request options at the reference guide, and Materials are "Building Materials", so the material/gs-mat is what I'm after, since I want to use surfaces, not building materials.

Solution
n = REQUEST ("Name_of_material", superficie_1, surface_name)

 

AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

View solution in original post

Oh! I didn't realize you were actually giving me request parameter I should use. It worked! Thanks! 🙂

Lingwisyer
Virtuoso

Now just to split the result. I have not tried STRSTR with an input that has multiple of the same divider but from the command description I assume you just need to run it twice. Position 1, split, position 2, split.

 

 

Ling.

AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Since the string parts I'm using follow the same character structure, I'm using STRSUB to separate the blocks of text. I came across a few issues though:

 

I have surfaces of different categories, like "PAR" for walls, "FOR" for ceiling, so on.. and those categories are parts of the surface name. I created an array variable to each of those categories, and stored the names there. (This object is running through all the surfaces in the project)

 

pedrocollares_1-1632152263347.png

 

When I try to print a value of those arrays, it works fine. When I try to create a substring out of it it gives errors.

 

pedrocollares_2-1632152815081.png

 

Seems to me the Variable[X] value can't output a substring. Maybe it isn't a string?

 

------------------

 

Also, I placed a subroutine to sort alphabetically the surface names. But where do I put subroutines? If I place an "END" statement at the master section, it will skip the 2D page. If I place the subroutine at the 2D page, it will give errors in 3D.

 

pedrocollares_3-1632153031416.png

 

 

Thanks a bunch for your help! 🙂

REQUEST "Name_of_material" returns empty string in parameter script. If you placed it in the master script, there will be an error with the parameter script run. Use GLOB_SCRIPT_TYPE to avoid the parameter script context.

 

The end of the master script can be avoided by adding a label at the end:

...

goto "masterEnd"

 

"subroutines":

...

return

 

"masterEnd":

 

Péter Baksa
Software Engineer, Library as a Platform
GRAPHISOFT SE, Budapest

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!