Find the next step in your career as a Graphisoft Certified BIM Manager!

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

How to get the geometry of Opening

Anonymous
Not applicable
Dear Support team,
I need your help.
I created an Add-on, and try to export the geometry data from ArchiCAD12. But I met a problem.
As you know, when I draw a door or window onto the wall, an opening will be created too. At this moment, I can get the geometry data or wall, door and window, which combines by lots of polygons, edges and vertices.
But how can I get the geometry data of opening, include the vertices, edges, polygons, GUID, material, and so on?

Thank you in advances.
Mike
9 REPLIES 9
Ralph Wessel
Mentor
Mike wrote:
But how can I get the geometry data of opening, include the vertices, edges, polygons, GUID, material, and so on?
If I understand the question properly, this is not (directly) achievable. When you place a window into a wall, all the geometry arising from that relationship is found in the bodies of the wall and window elements. There is no 'opening' body.

However, you could infer the opening faces based on surface normals etc. This would be easy for ordinary window types, but may be near impossible in the worst cases.
Ralph Wessel BArch
Anonymous
Not applicable
Ralph wrote:
Mike wrote:
But how can I get the geometry data of opening, include the vertices, edges, polygons, GUID, material, and so on?
If I understand the question properly, this is not (directly) achievable. When you place a window into a wall, all the geometry arising from that relationship is found in the bodies of the wall and window elements. There is no 'opening' body.

However, you could infer the opening faces based on surface normals etc. This would be easy for ordinary window types, but may be near impossible in the worst cases.
Dear Ralph Wessel,
It looks so worse, and it is really not a good idea to calculate the geometry data of opening by ourselves, and it is so difficult to calculate the worst case. I think the API can provides the some methods for us to get it. Wish you can provide some solutions.
Thank you in advance.
Mike
Ralph Wessel
Mentor
Mike wrote:
It looks so worse, and it is really not a good idea to calculate the geometry data of opening by ourselves, and it is so difficult to calculate the worst case. I think the API can provides the some methods for us to get it. Wish you can provide some solutions.
I completely agree with you. This is a poor way to calculate opening data, but there is no easy solution with the API. Sorry - I've spent a long time looking into this in the past and didn't come away with a good answer.
Ralph Wessel BArch
Anonymous
Not applicable
I need the geometry of openings too. I have a solution for windows and doors but not for empty openings.

For windows and door:
1. Collect all vertices of door or window object
2. Transform them to xy-plane (side projection of object).
3. Calculate convex hull of the points
4. Make an extrusion geometry using the points and wall thickness.
Ralph Wessel
Mentor
Matti wrote:
3. Calculate convex hull of the points
4. Make an extrusion geometry using the points and wall thickness.
This is what I was suggesting earlier, but it's not the kind of solution you'd expect via the API. It isn't 100% reliable either, because the geometry of the door/window might not be telling you anything about the opening, particularly if the object incorporates additional detailing for the wall surrounds that should not be considered part of the 'opening'. For example, it is quite possible to create doors/windows that don't have any opening at all, e.g. a niche, but it is impossible to determine that just by analysing the geometry of the object.

I've also generated opening profiles by clipping a polygon the full size of the joinery against the wall faces, the remainder presumed to be the opening. But this is also prone to error for the reasons described above and because it assumes the top or bottom of the wall hasn't been clipped (by a roof or SEO for example).
Ralph Wessel BArch
Anonymous
Not applicable
Found from documentation of ACAPI_Element_Get3DInfo:

Currently, this is the only way to obtain information on holes in walls. Look for polygons which have a horizontal normal vector perpendicular to the reference line of the wall.
It is sad that there is no 100% reliable way to obtain opening geometry.


Do you know is there any help using Neigs?
#define API_NeigFlg_HoleSel 0x0001
#define API_NeigFlg_Extra3D 0x0002

APINeig_Wind = 9, // hotspots in the window object
APINeig_WindHole = 10, // corners of window hole
APINeig_Door = 11, // hotspots in the door object
APINeig_DoorHole = 12, // corners of door hole
APINeig_Wind3D = 63, // 3d hotspots in the window object
APINeig_Door3D = 64, // 3d hotspots in the window object
ACAPI_Goodies (APIAny_NeigToCoordID,&neig,&coord);
Oleg
Expert
Matti wrote:
It is sad that there is no 100% reliable way to obtain opening geometry.
Yes, it is sad. But what is "opening geometry" seems not so simple question.
Imagine two adjacent windows, so actually opening hole will be only one.
Or window placed partially over top of a wall. A geometry may be real geometry this window in this wall, or it may be abstract geometry same window in a some wall, where this opening one and is not partial.

If a task is not like export and you can to change the project. May be will work the trick.
Create a temporary wall, same as parent of the opening.
Create a temporary opening exactly as required in this wall.
Get opening geometry. There is only one opening.
Delete the temporary wall.

Fot real geometry, create a wall same height etc and place opening same level and position. For "abstract" geometry, create a big wall and place an opening in middle.

PS: Just an idea. I am not sure this will work.
Ralph Wessel
Mentor
Oleg wrote:
But what is "opening geometry" seems not so simple question.
Correct - this question rises above the level of simple geometry, and ArchiCAD has no facility for that kind of data. I have even greater problems exporting data for thermal modelling for this reason, coupled with the fact that ArchiCAD models have no material data, e.g. thermal properties.
Ralph Wessel BArch
Oleg
Expert
Actually, I am not know how in the API to get actual width and height of an opening. (May be I missed it or some changed in last APIs).
It is not geometry actually but some values. A and B parameters is not actual width and height as there is concept of gaps. But this gaps are scripted formulas. And I dont know how to get this gaps calculated.
So I have to use ACAPI_Element_GetQuantities to get something like this.
But it is like a trick and limited.