cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
GDL
About building parametric objects with GDL.
SOLVED!

Dynamically moving text within interface script

GDL Enthusiast
Enthusiast

Hi,

 

I wonder, is it possible to dynamically move the x,y, position of text in the interface tab? My goal is to dynamically offset text, within the interface panel, depending on a parameter of the script.

 

My example would be to create a variable in the Parameters Tab called x_offset = 10mm

In the Interface tab I would add the code:

ui_outfield "Note", x_offset, 0, 120, 14

 

However it doesn't seem to work and defaults the position value to 0. Any help would be most welcome! Best to all.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Barry Kelly
Moderator

Sure you can.

Make your parameter a 'integer' because the interface is pixels, not distance.

 

BarryKelly_0-1699840797623.png

 

Then the script.

 

UI_OUTFIELD "Infield position", infield_pos,30,80,15
UI_INFIELD "infield_pos", infield_pos+85, 30,50,15

 

 

And the result.

BarryKelly_2-1699840955168.png

BarryKelly_3-1699841005729.png

 

Have fun chasing it around the interface.

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

8 REPLIES 8
Solution
Barry Kelly
Moderator

Sure you can.

Make your parameter a 'integer' because the interface is pixels, not distance.

 

BarryKelly_0-1699840797623.png

 

Then the script.

 

UI_OUTFIELD "Infield position", infield_pos,30,80,15
UI_INFIELD "infield_pos", infield_pos+85, 30,50,15

 

 

And the result.

BarryKelly_2-1699840955168.png

BarryKelly_3-1699841005729.png

 

Have fun chasing it around the interface.

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

That works beautifully with an integer, I never would have discovered that myself, thank you Barry you are a genius, quite exciting!

 

From the above, is possible to use the value from a dimension variable (x_offset) to drive the integer variable (infield_pos)?

 

My thinking would be in the Master Script to add something like:

infield_pos = INT(x_offset)

Parameter x_offset = infield_pos

 

But maybe it is not possible to use a value in mm to set an integer value in pixels, it would be great if it was though. Best to all.

GDL Enthusiast
Enthusiast

Found solution to the above of converting the dimension from mm. It works, thank you again Barry, so so helpful!


@GDL Enthusiast wrote:

Found solution to the above of converting the dimension from mm. It works, thank you again Barry, so so helpful!


Yes that would work too.

All lengths in GDL are in meters, regardless of your working units.

So multiply by 1000 to get mm.

 

But just be aware the default user interface is only around 444 x 296 a minimum of 480 wide x 266 high pixels (it is customisable and can be a little bit bigger), but it will be very easy to exceed this limit with mm.

 

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

The settings dialog minimum width has changed to 480 pixels in AC24, and the minimum height is 266 pixels.

 

 

 

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

@Peter Baksa wrote:

The settings dialog minimum width has changed to 480 pixels in AC24, and the minimum height is 266 pixels.

Aaaah thanks for this info, I knew the old values were wrong somehow but never knew for sure. When using the old values with listfields, they were cut at the bottom so I ended finding the 266px by testing myself. Same for 480, one day I went beyond 444 and noticed it was fine so I went further until the display was cut.

 

However, this info needs to be updated though, here in the online guide : https://gdl.graphisoft.com/reference-guide/the-user-interface-script

Currently, the size of the available area is fixed at 444 x 296 pixels, and the size_x and size_y parameters are not used.

And also in the GDL reference pdfs. In my 26 installation, it is the same on page 263

Currently, the size of the available area is fixed at 444 x 296 pixels, and the size_x and size_y parameters are not used.

 

https://mfbim.fr | https://youtube.com/@mfbim
AC21 FRA 3005 - AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro

@MF BIM ,

That is just the default minimum size.

You can set a custom dialogue much larger if you want to.

Here I have just increased one of my window interfaces.

 

BarryKelly_0-1700184072366.png

 

UI_DIALOG `CUSTOM SETTINGS`, 750,550

 

So there is much more space to be had if you need it.

I probably wouldn't go too big though.

 

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

@Barry Kelly,

Yes, I know this, I was just rebounding on the fact that if you do not input those optional inputs for UI_DIALOG, the default dimensions are wrong according to the GDL guides.

https://mfbim.fr | https://youtube.com/@mfbim
AC21 FRA 3005 - AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro
Learn and get certified!