From 73ead5c4bae03b02092585a85656a2ff386d6a3e Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Mon, 15 Jun 2026 15:41:06 +0900 Subject: [PATCH 1/2] add quick test for quads when drawing hexa --- Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h b/Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h index d08445b1fb4..3d934778f9c 100644 --- a/Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h +++ b/Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h @@ -474,6 +474,17 @@ struct SOFA_CORE_API DrawElementMesh const auto& elements = topology->getHexahedra(); const auto& facets = topology->getQuads(); + if(facets.empty()) + { + static bool firstTime = true; + if (firstTime) + { + msg_error("DrawElementMesh") << "Drawing hexahedra needs the associated quads in the topology."; + firstTime = false; + } + return; + } + for ( auto& p : renderedPoints) { p.resize(elementIndices.size() * sofa::geometry::Quad::NumberOfNodes); From 83673ff7f633194ddb0a4175f03e2c11d12c264a Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Tue, 16 Jun 2026 06:54:44 +0900 Subject: [PATCH 2/2] add tests for triangles/tetra too --- Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h b/Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h index 3d934778f9c..36cd5aa9f8d 100644 --- a/Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h +++ b/Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h @@ -328,6 +328,17 @@ struct SOFA_CORE_API DrawElementMesh const auto& elements = topology->getTetrahedra(); const auto& facets = topology->getTriangles(); + if(facets.empty()) + { + static bool firstTime = true; + if (firstTime) + { + msg_error("DrawElementMesh") << "Drawing tetrahedra needs the associated triangles in the topology."; + firstTime = false; + } + return; + } + for ( auto& p : renderedPoints) { p.resize(elementIndices.size() * sofa::geometry::Triangle::NumberOfNodes);