BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Wishes
Post your wishes about Graphisoft products: Archicad, BIMx, BIMcloud, and DDScad.

Average function in GDL

Nader Belal
Mentor
GDL needs Average sum of values/parameters/variables functions.

It's needed for some calculations such as areas or volumes, besides it makes scripting a little bit easier
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
5 REPLIES 5
Barry Kelly
Moderator
You already have it.
Add the variables together and divide by the number of variables.

If there was a function to do this you would still have to list all of the variables so there would be very littly difference in the amount of scripting.

i.e. (var_1+var_2+var_3+var_4)/4

compared to a proposed ... AVERAGE(var_1,var_2,var_3,var_4)

I don't see the need for it unless i am not understanding what you need.

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
Lingwisyer
Guru
Unless you are wanting a median or an average function that excludes outliers. In the second case, a single function is unlikely as there are too many definitions of what an outlier can be.



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Nader Belal
Mentor
@Barry Kelly

The average function is already have been implemented in many languages from long time ago, it could be even considered as stable mathematical function to provide with the languages libraries, so the question should be why GDL doesn't have one, not how you can create your own average function.

@ Lingwisyer
a median function would also be perfect to add, even the most basic and simplest one too.
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Barry Kelly
Moderator
Moonlight wrote:
The average function is already have been implemented in many languages from long time ago, it could be even considered as stable mathematical function to provide with the languages libraries, so the question should be why GDL doesn't have one, not how you can create your own average function.
Sure, but my point was why would we need a function that takes just as much to type out as it does to do the actual calculation.
We don't have an ADD(value_1, value_2, value_3) or SUM(value_1, value_2, value_3) as it would be in spreadsheets.
Just as easy to type... value_1+value_2+value_3.

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
Lingwisyer
Guru
And it only works in spreadsheets as you can go and select every relevant cell after typing the command which is something that you cannot do in this type of case.



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Learn and get certified!