how to get the zone element that contains another zone element?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-12-06 11:02 AM - last edited on 2022-09-29 09:50 AM by Daniel Kassai
I want to query the zone element that contains the selected zone element.
Is there any API can solve it?
How to get the outer zone that contains the inner zone? The inner zone is known.
Solved! Go to Solution.
- Labels:
-
Add-On (C++)
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
Active Thread Ltd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-12-09 07:56 AM
Is there any API that can get different spatial relationship between elements?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-12-09 12:27 PM
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".
Archicad Designer and Teacher
Archicad 15 to 27 FRA FULL
OS 13 Ventura - MacBook Pro M2 max- 32Go RAM
"Quality is never an accident ; it's always the result of an intelligent effort" John Ruskin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
Are there other methods that can get the spatial relationship of two polygon?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-12-09 02:08 PM
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
Active Thread Ltd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
'4) For each zone found, test if its polygon encloses the selected zone polygon'
Is there any api method that can do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Active Thread Ltd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Whether it is possible to solve this problem by Geometry API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
Active Thread Ltd