Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Polygon operations

Anonymous
Not applicable
Is there someone willing to show an example of use of the "polyoperations" functions?
Please!!!
I can't find my way in using this function.
12 REPLIES 12
Laszlo Nagy
Community Admin
Community Admin
Does this page help?
Would be helpful to put your AC version in your signature.

AC12:
http://www.graphisoft.com/ftp/techsupport/documentation/developer_docs/BasicLibraryDoc/12/Window-Mac...

AC13:
http://www.graphisoft.com/ftp/techsupport/documentation/developer_docs/BasicLibraryDoc/13/Window-Mac...
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Anonymous
Not applicable
Thanks Laszlo,
but i was more thinking about the Polyop extension (ch=INITADDONSCOPE ("PolyOperations ", "", "")) which is said by Zsolt to be a more effective way to do such operations.
Although I will look with this macro.
But that would be very very very nice to see just a little example of use of the extension to see how we can use it. The source containers etc.. are a bit difficult to understand from scratch.
Maybe there is an object in the library using it?
Thanks in advance,
olivier

AC v13, winVista
ztaskai
Graphisoft Alumni
Graphisoft Alumni
There is an example object called PolyOperations_Example.gsm in the Sample Objects folder of the Basic Library.

You can download it from http://www.graphisoft.com/support/developer/downloads/

The extension is much more effective and capable than the macro indeed!

Regards,
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Anonymous
Not applicable
Thanks a lot!
BTW I have been trying to use the polyoperations macro to calculate areas, but it appears to me that the results are bit different than what they should be. (if i draw a polygon and see the area)
Is that a bug?
You can't use the addon to calculate areas, can you?
(in that case it is not documented in the manual)
thanks,
regards,
olivier
ztaskai
Graphisoft Alumni
Graphisoft Alumni
Olivier wrote:
I have been trying to use the polyoperations macro to calculate areas, but it appears to me that the results are bit different than what they should be. (if i draw a polygon and see the area)
Is that a bug?
It can be considered as a bug, sure. Please report the details and we'll see about the priority.
Olivier wrote:
You can't use the addon to calculate areas, can you?
(in that case it is not documented in the manual)
The documentation is complete - consequently there is no area calculation. One reason to include it would be to completely replace the old macro...

Regards,
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Anonymous
Not applicable
Here is the code from the Polygonoperations.gsm macro:

----
area=0

tempNumPnts = nsp/3

areaLX = get(1) ! Last point
areaLY = get(1)
!!ziiz=get(1)
areaFX = areaLX ! First point
areaFY = areaLY

for areaI=1 to tempNumPnts-1
areaX = get(1)
areaY = get(1)
!!ziiz=get(1)
area = area + (areaX + areaLX) * (areaY - areaLY) * 0.5

areaLX = areaX
areaLY = areaY
next areaI
area = area + (areaFX + get(1)) * (areaFY - get(1)) * 0.5


-------

I add this in the beginning to give my polygon:
-------
for i=1 to vardim1(ac_coords)
put ac_coords[2],ac_coords[3],0
next i

------
ac_coords comes from the accessories API

but the resulting area is totally false...

I don't understand this code anyway which should call 3 times "get" per loop but "gets" only 2 times per loop.
Is there something obvious that I missed?

Thanks in advance,
Olivier
Anonymous
Not applicable
Ok, I think I fixed the little bug in the macro:
--
for areaI=1 to tempNumPnts-1
---
should be
--
for areaI=1 to tempNumPnts-2
--
now it seems to work.

However it doesn't work if there are holes in the polygon.
Some more work should fix this second problem.
Anonymous
Not applicable
and added of course this ziiz=get(1) in the loop to get 3 times instead of 2
ztaskai
Graphisoft Alumni
Graphisoft Alumni
The macro is designed to handle 2D polygons defined by two coordinate points. You modified it to handle 3 coordinates per point:)

Regs,
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...