2019-12-06 11:02 AM - last edited on 2022-09-29 09:50 AM by Daniel Kassai
Solved! Go to Solution.
2019-12-11 10:15 AM
// Returns the relative position of the Polygon and the Polygon parameter RelativePosition GetPosition (const CustomPolygon2D& poly, Boundary boundaries, DetailedRelativePosition* detailed = nullptr) const;
2019-12-09 07:56 AM
2019-12-09 12:27 PM
2019-12-09 12:38 PM
Christophe wrote:Thanks.
Hello DevJeer,
Between one Zone and other elements we just have to create a schedule to show the relation between them
But if there are 2 Zones at the same place, an element into them can not know with which be linked (and only one of them).
So I think if the are two zones in a same area... They are probably not able to communicate together 😕
It is like a "mother zone" and linked "daughter element".
2019-12-09 02:08 PM
2019-12-10 01:57 AM
Ralph wrote:Thanks.
I don't know of an API function that will automatically retrieve the relationship between zones. But you could do the following:
1) Get the selected zone
2) Get the polygon of the selected zone
3) Iterate through the model database to search for zone elements
4) For each zone found, test if its polygon encloses the selected zone polygon
2019-12-10 12:07 PM
bool isParent(const ZoneElement& testZone, const Polygon& childPolygon) { return ((testZone.getPolygon() != nullptr) && //Check the test zone has a valid polygon testZone.getPolygon()->encloses(childPolygon)); //…and the test zone polygon encloses the child polygon }I know the API has built up a comprehensive geometry library over the years - maybe one of the GS guys could point you to the right function?
2019-12-11 02:13 AM
Ralph wrote:Thanks.
I'm sure there is. We started our element and polygon classes a long time ago, so I haven't delved into the ARCHICAD API for that. If we're testing whether a zone encloses another polygon, we just do something like this:bool isParent(const ZoneElement& testZone, const Polygon& childPolygon) { return ((testZone.getPolygon() != nullptr) && //Check the test zone has a valid polygon testZone.getPolygon()->encloses(childPolygon)); //…and the test zone polygon encloses the child polygon }I know the API has built up a comprehensive geometry library over the years - maybe one of the GS guys could point you to the right function?
2019-12-11 10:15 AM
// Returns the relative position of the Polygon and the Polygon parameter RelativePosition GetPosition (const CustomPolygon2D& poly, Boundary boundaries, DetailedRelativePosition* detailed = nullptr) const;