License delivery maintenance is planned for Saturday, July 26, between 12:00 and 20:00 CEST. During this time, you may experience outages or limited availability across our services, including BIMcloud SaaS, License Delivery, Graphisoft ID (for customer and company management), Graphisoft Store, and BIMx Web Viewer. More details…
2024-08-18 12:31 AM
Hello, I'm new to Gdl.
I have an object in my hand. I want to make a gdl object where I can choose which floor level this object will be at. However, I could not write a suitable code for this. There is the feature I want in the elevator object, but the gdl codes were too complicated for me. Which command should I use for this?
Thank you.
2024-08-18 02:28 PM
Hello @Bhtsz_pyd ,
You would need to REQUEST the STORY_INFO global variable. It holds info on all stories including the names, elevations and heights.
n = REQUEST("STORY_INFO", expr, nStories,
index1, name1, elev1, height1 [,
index2, name2, ...])
2024-08-18
09:08 PM
- last edited on
2024-08-20
01:51 PM
by
Laszlo Nagy
Thank you MF BIM for your reply.
Obviously I tried that, but that's where your problem starts. What I want to do is to create a parameter that I can choose between. Ground Floor Plan, 1st Floor Plan, 2nd Floor Plan and link the position of the object to that floor. With the code you mentioned, I can get data such as story name or story height. I can also write it to the screen with the Text2 command. However, I cannot create a parameter that I can choose between them. Is there a sample video you can suggest about this? Creating a parameter similar to the “car position” parameter in the elevator object.
2024-08-19
01:25 AM
- last edited on
2024-08-20
01:52 PM
by
Laszlo Nagy
Hi,
the additional code you need is:
n = REQUEST ("Story", "", index, story_name)
Returns in the index and story_name variables the index and the name of the current story.
n = REQUEST ("Home_story", "", index, story_name)
Returns in the index and story_name variables the index and the name of the home story.
you cannot physically move the object to a different story using the GDL code, but you can move where it appears in floor plan, and 3d Position using the code...
i.e.
n_current = REQUEST ("Story", "", index_current, story_name_current)
n_home = REQUEST ("Home_story", "", index_home, story_name_home)
nn_current = REQUEST ("STORY_INFO", index_current, total_stories, Index_Of_current, Name_Of_current, Elevation_Of_Current, Height_of_Current)
nn_home = REQUEST ("STORY_INFO", index_home, total_stories, Index_Of_Home, Name_Of_Home, Elevation_Of_Home, Height_of_Home)
nn_Ground = REQUEST ("STORY_INFO",0, total_stories, Index_Of_Ground, Name_Of_Ground, Elevation_Of_Ground, Height_of_Ground)
nn_First= REQUEST ("STORY_INFO",1, total_stories, Index_Of_First, Name_Of_First, Elevation_Of_First, Height_of_First)
nn_Second = REQUEST ("STORY_INFO",2, total_stories, Index_Of_Second, Name_Of_Second, Elevation_Of_Second, Height_of_Second)
and then you have the ability to calculate position/display based on designated story.
you can then have a parameter that has the story you wish to display
show_on_story
i.e.
values "show_on_story" "Ground Floor Plan", "First Floor Plan", "Second Floor Plan"
!2D Script
n_current = REQUEST ("Story", "", index_current, story_name_current)
if show_on_story = "Ground Floor Plan" and index_current = 0 then
!Show 2d content for ground floor option here
endif
if show_on_story = "First Floor Plan", and index_current = 1 then
!Show 2d content for First floor option here
endif
if show_on_story = "Second Floor Plan", and index_current= 2 then
!Show 2d content for Second floor option here
endif
2024-08-19 10:18 AM
If you want to move the car then I would do it like this :
- Have an CarElevation parameter (length type)
- Have a CarPosition parameter (integer type)
- Request the story names and elevations after you requested the story info) and use VALUES{2} to display them as a drop down menu
- After selecting the CarPosition, calculate the sum of the elevations up to the chosen story
- Give that value to the CarElevation parameter to move the car
If you're new to GDL, you may need to go there to get some of the basics : https://gdl.graphisoft.com/gdl-basics
2024-08-19 09:10 PM
Thank you both very much for your response. However, I think I asked my question wrong. The question I am looking for an answer to is to create an infinite loop “values{2}”
i.e.
values{2} “stryname” , 1 , Ground Floor Plan,
2, First Floor Plan,
3, Second Floor Plan
I can write this manually, but depending on the size of the project, sometimes it can be a 10-storey project, sometimes a 20-storey project. Every time I add a new floor to the project, I want that stories to be added to the parameter automatically.
2024-08-20
03:18 AM
- last edited on
2024-08-20
01:52 PM
by
Laszlo Nagy
You could PUT all of the values into a parameter through a loop using nStories from your Request. From there you can use GET to insert it into your VALUES{2}.
https://gdl.graphisoft.com/reference-guide/parameter-buffer-manipulation
n = REQUEST ("Story_info", "", nr, ss)
FOR i = 1 TO nr
!nr = STR ("%.0m", ss [4 * (i - 1) + 1])
!name = ss [4 * (i - 1) + 2]
!elevation = STR ("%m", ss [4 * (i - 1) + 3])
!height = STR ("%m", ss [4 * (i - 1) + 4])
AC22-28 AUS 3110 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win11 | R5 2600 | 16GB | GTX1660 |
2024-08-21
01:56 AM
- last edited on
2024-08-26
11:24 PM
by
Laszlo Nagy
FYI
Put only allows Numbers, so you cant use put on a story name that contains text.
but you can use:
dim s_info[]
dim s_index[]
dim s_name[]
n = REQUEST("STORY_INFO", "", nrstories, s_info)
for j = 1 to nrstories
s_index[j] = s_info[j*4-3]
temp_name = s_info[j*4-2]
!!!!-------Note: you can't have the same name description for 2 different numbers, so this bit here for unique story names------!!!!
if j > 1 then
for ii = 1 to j -1
if s_name[ii] = s_info[j*4-2] then
temp_name = s_info[j*4-2] +"Story="+str(s_index[j],1,0)
endif
next ii
endif
!!!!-------Note: you can't have the same name description for 2 different numbers, so this bit here for unique story names------!!!!
s_name[j] = temp_name
next j
values{2} "stryname" s_index, s_name