2021-09-08 03:36 AM - last edited on 2021-09-14 01:19 PM by Noemi Balogh
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:
If anyone is able to give me some directions, I'd be very thankful! 😊
Solved! Go to Solution.
2021-09-20 05:23 AM
n = REQUEST ("Name_of_material", superficie_1, surface_name)
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2021-09-21 11:59 AM
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":
2021-09-08 03:49 AM - edited 2021-09-08 04:19 AM
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.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2021-09-08 03:14 PM - edited 2021-09-08 03:27 PM
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.
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! 🙂
2021-09-09 03:30 AM - edited 2021-09-09 03:42 AM
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:
Ling.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2021-09-14 10:55 PM
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.
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!
2021-09-15 03:19 AM - edited 2021-09-15 03:45 AM
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.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2021-09-20 04:51 AM - edited 2021-09-20 05:02 AM
Lingwisyer, I suppose I'm almost there! What I managed so far:
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:
I was able to print out the texture name used in that surface, using the "gs_mat_texture", with the following:
And achieving this result:
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.
2021-09-20 05:23 AM
n = REQUEST ("Name_of_material", superficie_1, surface_name)
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2021-09-20 05:30 AM
Oh! I didn't realize you were actually giving me request parameter I should use. It worked! Thanks! 🙂
2021-09-20 05:40 AM
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.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |