I am a bit confused with something. I followed the CAD viewer example as closely as possible, and currently it seems the colors we are reading do not match the CAD file.
It seems we are somehow permuting the colors of the nodes. However, this is the snippet oh where we load our data:
NodeGeometry getNodeGeometry(A3DTree* const hnd_tree, A3DTreeNode* const hnd_node) {
NodeGeometry geometry;
// Extract the geometry as an A3DMeshData and collect their position and color to render it
A3DMeshData mesh_data;
A3D_INITIALIZE_DATA(A3DMeshData, mesh_data);
A3DStatus code = A3DTreeNodeGetGeometry(hnd_tree, hnd_node, A3D_TRUE, &mesh_data, 0);
if (code == A3D_SUCCESS) {
Mat4 position = he_extract_position(hnd_node);
Vec4 color = he_extract_color(hnd_node);
geometry.color = color;
geometry.transformation = position;
/*more stuff*/
}
return geometry;
}
We are clearly loading the position/transformation at the exact same time as the color and we are completely certain we are not ever over writing the color. So we don’t understand how one can be right and the other wrong. They should both either be correct or incorrect.
And we got the input file from autodesk, we used the second example titled rac_basic_sample_project.rvt
I have asked a colleague to look at the code and he also seemed confused as it seems we are doing what the tutorial says to do. We are hoping you can give us some pointers as to what is happening.
Hello @camilo.talero
By checking the Revit file, the color information is stored in A3DTessFaceData::m_puiStyleIndexes. You can refer to the example MeshViewer, and look at the function RepresentationItem::build_buffer_per_style.
As for IfcGUID, they are stored as attribute.
Sorry but I am not sure what you mean by your response.
The HE example that uses the key-words “Mesh Viewer” (afaik) is this https://docs.techsoft3d.com/exchange/latest/tutorials/c/mesh-viewer-sample.html
Hello @camilo.talero,
The sample I mentioned comes with the package “…\samples\exchange\exchangesource\MeshViewer” and the function name mentioned is in “…\MeshViewer\model\he\representation_item.cpp”.
Please let me know if this sample helps you solve the problem. Thank you.
This has been extremely helpful, thank you for the help you have given us so far. I have looked at build_buffer_per_style and I have a much better idea of the intended way of getting color information.