We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.

Calculate area in GDL properties script

Kaj_AL
Enthusiast

Hi!

 

For starters, I'm quite new to GDL. I have an object I made that is a slab accessory. How would I go about using the area of the slab (or the accessory, they're equal) in the properties script?

 

Kind regards

Kaj

Archicad 24-27 SWE
Dell Precision 5560, Windows 11 Pro
11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz 2.61 GHz
4 REPLIES 4
Barry Kelly
Moderator

I don't think you would, unless you are trying to use the old 'List' schemes to calculate quantities.

The list scheme is very old and is no longer being updated.

The 'new' Interactive Schedules do not need any information from the property script.

 

Can you explain more of what you are trying to achieve?

I have not delved into slab accessory objects for a long time.

I am not sure if it can get the area from the slab it is associated to.

It can certainly get all of the perimeter co-ordinates from which I think you could calculate the area (don't ask me how).

 

Even if you can't get the area from the accessory object, you can always just schedule the area of the slab it is associated to.

Don't forget this is just an accessory.

Most information you can get from the associated slab.

 

Barry.

 

 

Barry.

 

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Hi Barry, and thanks for your answer!

 

Here's my original post, which was more a general question on how to do it: https://community.graphisoft.com/t5/Developer-forum/Slab-like-GDL-or-Param-O-object-for-city-plannin...

It's pretty much a basic volume for buildings in early stages, from which the user can get a lot of basic information.

 

I was trying to use the List scheme actually. As I understand it neither Interactive Schedules nor Expression Properties (Property Expressions?) can handle the Properties Script? But if the List Schemes aren't being updated, can the Properties Script even be used anywhere?

 

In general, I feel that objects, schedules, lists, expression properties, components, elements etc. are all quite solitary and difficult to combine and in need of an overhaul. Maybe I'm using them wrong?

 

Kind regards

Kaj

Archicad 24-27 SWE
Dell Precision 5560, Windows 11 Pro
11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz 2.61 GHz

The list scheme is the only thing that uses the property script in an object as far as I know.

It still works, just not with new tools such as morphs, new stair objects and I am not sure about new beams and columns (it did work with the old ones).

It is basically an early version of the Interactive Schedules, just harder to work with.

 

Schedules don't use property scripts at all.

 

The other post you link to, you have created an accessory that associates to a slab and shows the volume (mass) of your proposed building if I follow it correctly.

The accessory object reads the co-ordinates of your slab so it can follow it.

Mathematically it is possible to determine the area from those co-ordinates and the volume is the easy bit - multiply by the height.

The maths for this is a little beyond me unless I do some research, but I am sure I have seen formulae to calculate areas of polygons based on node co-ordinates.

I am not sure if an accessory object can get the slab area directly from the slab itself but you do have that info in the slab via interactive schedules already.

If you make the slab the height of to building mass, then you also have the volume.

I assume you would be placing a slab for each story level so they don't all have to be the same footprint.

You could then use properties with expressions to calculate things like occupancy based on number of people per square meter or the area per apartment if you divide the area by the number of apartments you want.

 

Also be aware that a morph is a 3D object, you can easily get the volume of it and a projected are per storey in the schedules.

It may not be quite so easy to manipulate the shape as you will need to push/pull edges in 3D rather than the perimeter on the plan as the top of a morph does not follow the bottom shape.

Again you could attach properties and use expressions in those properties to get what you want.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Okay!

 

My best solution now is using composite slabs with every story being a different skin. Since the object is made to be an easy step from 2D, Autocad-polylines which the office use now, having the entire building as one volume rather than every story is preferable. In case of setbacks I've used the Opening tool to remove parts of the slab.

 

The reason for making an object is ease of use, since everyone at the office are Archicad beginners, and after trying out different solutions, I came to the conclusion that this was the easiest way to work.

 

As for the mathematics of it, my googling led me to something called the Shoelace Formula, which seems to be the solution. However, both my math skills and my GDL skills are insufficient to implement it, which is why I hoped there was a precoded way to do it!

 

EDIT: Update, I found a readymade VOLUME3D() function that allows me to get the volume of an object. From this I can get the area if I have a simple object without setbacks etc. So not great, but a start.

 

/Kaj

Archicad 24-27 SWE
Dell Precision 5560, Windows 11 Pro
11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz 2.61 GHz