2020-07-10 07:37 AM - last edited on 2021-09-15 11:58 AM by Noemi Balogh
2020-07-10 10:44 AM
2020-07-10 11:33 AM
Ralph wrote:Thank you. I have read about these APIs. But what I want is to fetch the mesh information, that is to say, the coordinates of the vertex on the mesh, the index of vertex in the triangles and the transformation matrix. I have found the ACAPI_3D_GetComponent may solve these problems. But I get quite confused here.
There are two possible ways to approach this.
- 1. ModelerAPI - This is by far the easiest way to access information about the 3D model, but there doesn't seem to be documentation for it anywhere. However, you can deduce the meaning of most of it fairly easily. Look in the devkit at Support/Modules/GSModelDevLib
2. ACAPI_Element_Get3DInfo - This has documentation with the other API docs, but is a bare C interface. It's very comprehensive though
2020-07-10 12:51 PM
scandi wrote:Archicad's 3D engine doesn't present data in a conventional way. There are broad similarities with lists of bodies, faces, edges and vertices. But faces can be complex polygons with concavity and even overlaid 'hole' faces. It doesn't present a triangle-based mesh through the API. The closest you can get is to use
what I want is to fetch the mesh information, that is to say, the coordinates of the vertex on the mesh, the index of vertex in the triangles and the transformation matrix
1. transformation matrix. I get the transformation matrix in component3D.body.tranmat. However, It is a little bit different from what I used to think. It seems that every body has its own vertex data and the tansformation matrix. But in a render machine, there should be some instances of one mesh, each instance with its own transformation matrix. So I was wondering whether there is something like 'instance' or how to get the origin mesh.
2. triangles. I can get the polygon indice using API_GetComponent3D. However, what I want is triangle not polygon. But I thought there might not be an API to convert the polygons indice gotten from the API_GetComponent3D into triangle.
2020-07-10 03:09 PM
Ralph wrote:Thank you.
scandi wrote:Archicad's 3D engine doesn't present data in a conventional way. There are broad similarities with lists of bodies, faces, edges and vertices. But faces can be complex polygons with concavity and even overlaid 'hole' faces. It doesn't present a triangle-based mesh through the API. The closest you can get is to use
what I want is to fetch the mesh information, that is to say, the coordinates of the vertex on the mesh, the index of vertex in the triangles and the transformation matrix
1. transformation matrix. I get the transformation matrix in component3D.body.tranmat. However, It is a little bit different from what I used to think. It seems that every body has its own vertex data and the tansformation matrix. But in a render machine, there should be some instances of one mesh, each instance with its own transformation matrix. So I was wondering whether there is something like 'instance' or how to get the origin mesh.
2. triangles. I can get the polygon indice using API_GetComponent3D. However, what I want is triangle not polygon. But I thought there might not be an API to convert the polygons indice gotten from the API_GetComponent3D into triangle.ACAPI_3D_DecomposePgonto break faces into simpler convex polygons, but these are not triangles either.
Extracting the date you require from the 3D components is a bit long-winded. Each body has a transformation matrix and lists indices of faces, edges and vertices – all of which may be shared with other bodies. So in effect different bodies may share data in common but have a different transformation matrix. I recommend using ModelerAPI because it save you from having to code all that detail.
2020-07-10 03:29 PM
scandi wrote:Yes, vertices, edges etc are definitely shared between bodies – but I'm not aware of any documentation explaining the algorithm behind it. If an item, e.g. a vertex, is shared between bodies, you will see the same vertex index in both bodies.
What I want to get are the data shared by these bodies (i.e. the vertex coordinate, the normals, the vertex indice making up the faces and etc.) and each's transformation matrix. Is there any api about their information?
2020-07-10 03:50 PM
Ralph wrote:I think we have some different opinions about "shared". I refer "shared" to the mesh data which is shared by different instances. The instances get their own coordinates by transforming from mesh data. So I was wondering if I could get the mesh data from the APIs. If so, could you please give me some hints?
scandi wrote:Yes, vertices, edges etc are definitely shared between bodies – but I'm not aware of any documentation explaining the algorithm behind it. If an item, e.g. a vertex, is shared between bodies, you will see the same vertex index in both bodies.
What I want to get are the data shared by these bodies (i.e. the vertex coordinate, the normals, the vertex indice making up the faces and etc.) and each's transformation matrix. Is there any api about their information?
2020-07-10 05:10 PM
scandi wrote:As I said earlier, I'm not aware of any documentation that will give you a definitive answer to that question. I am also not a Graphisoft employee, so I don't have deep access into the source code. All I can tell you is things I have observed from the data that may point to the true situation.
I think we have some different opinions about "shared". I refer "shared" to the mesh data which is shared by different instances. The instances get their own coordinates by transforming from mesh data. So I was wondering if I could get the mesh data from the APIs. If so, could you please give me some hints?
2020-07-10 05:28 PM
Ralph wrote:OK. Thanks a lot!
scandi wrote:As I said earlier, I'm not aware of any documentation that will give you a definitive answer to that question. I am also not a Graphisoft employee, so I don't have deep access into the source code. All I can tell you is things I have observed from the data that may point to the true situation.
I think we have some different opinions about "shared". I refer "shared" to the mesh data which is shared by different instances. The instances get their own coordinates by transforming from mesh data. So I was wondering if I could get the mesh data from the APIs. If so, could you please give me some hints?
I am fairly confident that different instances of the same object with the same parameters reference the same bodies, faces, edges etc. and simply apply a different transformation matrix. Beyond that, I don't know – all you can do is experiment as we have done. Most of what we know about this part of the API has been based on protracted experimentation. There are all kinds of oddities under the bonnet - incomplete or void faces, degenerated polygons, 'magic' uses for the sign of an index etc etc.
What you will definitely not get from the API is a neatly triangulated mesh. I've written export utilities for 3rd-party rendering software in the past, and you'll most likely need to write code to convert the API data to the engine's requirements.
2020-07-20 09:38 PM
Ralph wrote:Thanks for your info. I have the same question here, wanting to get triangles from polygons with Archicad API. Just curious is there any ways to do the conversion easily? For example, anyone tried using Libtess2 for it?
scandi wrote:As I said earlier, I'm not aware of any documentation that will give you a definitive answer to that question. I am also not a Graphisoft employee, so I don't have deep access into the source code. All I can tell you is things I have observed from the data that may point to the true situation.
I think we have some different opinions about "shared". I refer "shared" to the mesh data which is shared by different instances. The instances get their own coordinates by transforming from mesh data. So I was wondering if I could get the mesh data from the APIs. If so, could you please give me some hints?
I am fairly confident that different instances of the same object with the same parameters reference the same bodies, faces, edges etc. and simply apply a different transformation matrix. Beyond that, I don't know – all you can do is experiment as we have done. Most of what we know about this part of the API has been based on protracted experimentation. There are all kinds of oddities under the bonnet - incomplete or void faces, degenerated polygons, 'magic' uses for the sign of an index etc etc.
What you will definitely not get from the API is a neatly triangulated mesh. I've written export utilities for 3rd-party rendering software in the past, and you'll most likely need to write code to convert the API data to the engine's requirements.