How to interpret: Multiple faces have an edge between vertices 0 and 2 in the same order.

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Sietse Achterop
Posts: 72
Joined: Tue Sep 14, 2021 3:01 am

How to interpret: Multiple faces have an edge between vertices 0 and 2 in the same order.

Post by Sietse Achterop » Fri Dec 03, 2021 8:46 am

Hello list,

Trying to create an stl-file to be used in ContactMesh, but my python script ends with:

Code: Select all

Traceback (most recent call last):
  File "/home/sietse/Roeien/Modelling/OpenSim/MyCode/Pusher/pusher.py", line 170, in <module>
    blad = osim.ContactMesh('brick.stl',
  File "/home/sietse/Software/OpenSim/opensim/sdk/Python/opensim/simulation.py", line 14443, in __init__
    _simulation.ContactMesh_swiginit(self, _simulation.new_ContactMesh(*args))
RuntimeError: std::exception in 'OpenSim::ContactMesh::ContactMesh(std::string const &,SimTK::Vec3 const &,SimTK::Vec3 const &,OpenSim::PhysicalFrame const &)': SimTK Exception thrown at ContactGeometry_TriangleMesh.cpp:451:
  Bad call to Simbody API method ContactGeometry::TriangleMesh::Impl::TriangleMesh::Impl(): Multiple faces have an edge between vertices 0 and 2 in the same order.
  (Required condition 'backwardEdges.find(pair<int, int>(edges[j][1], edges[j][0])) == backwardEdges.end()' was not met.)
I don't know how to interpret this message :(
Using python and the stl-library from [url]https://github.com/WoLpH/numpy-stl[url] I created a simple box.
brick.png
brick.png (24 KiB) Viewed 268 times
This is an example screenshot that I took with paraview. Note that the bottom side has more triangles than the other sides.
The idea is that this side it the one to make contact with similar surfaces. One such surface is large, so I create a large number of triangles to make ElasticFoundationForce work better (I hope).

I think the mesh-file is correct, but there probably are additional requirements on how the triangles are to be placed.
Maybe the order in which I describe the triangles or faces?
Added the python script for completeness.

Thanks in advance, Sietse
Attachments
brick.txt
Why is the py-extension not supported?
(3.12 KiB) Downloaded 3 times

User avatar
Sietse Achterop
Posts: 72
Joined: Tue Sep 14, 2021 3:01 am

Re: How to interpret: Multiple faces have an edge between vertices 0 and 2 in the same order.

Post by Sietse Achterop » Fri Dec 03, 2021 2:14 pm

I found out that what a "facet normal" is and that not all normal where pointing outward from the brick.
I made it so that, looking from the inside, following the 3 vertices of a triangle, I now am going clockwise and therefore the
normal is pointing outward.
But there still is an error:

Code: Select all

Traceback (most recent call last):
  File "/home/sietse/Roeien/Modelling/OpenSim/MyCode/Pusher/pusher.py", line 170, in <module>
    blad = osim.ContactMesh('brick.stl',
  File "/home/sietse/Software/OpenSim/opensim/sdk/Python/opensim/simulation.py", line 14443, in __init__
    _simulation.ContactMesh_swiginit(self, _simulation.new_ContactMesh(*args))
RuntimeError: std::exception in 'OpenSim::ContactMesh::ContactMesh(std::string const &,SimTK::Vec3 const &,SimTK::Vec3 const &,OpenSim::PhysicalFrame const &)': SimTK Exception thrown at ContactGeometry_TriangleMesh.cpp:474:
  Bad call to Simbody API method ContactGeometry::TriangleMesh::Impl::TriangleMesh::Impl(): Each edge must be shared by exactly two faces.
  (Required condition 'iter2 != backwardEdges.end()' was not met.)
I think each edge is shared by at least (update: exact of course) two faces, but I still get the error.

What could be wrong now? Thanks in advance.
Attachments
brick.stl.txt
Ascii version exported from meshlab
(4.67 KiB) Downloaded 4 times
brick.txt
Corrected version
(3.31 KiB) Downloaded 3 times
Last edited by Sietse Achterop on Sun Dec 05, 2021 7:23 am, edited 1 time in total.

User avatar
Sietse Achterop
Posts: 72
Joined: Tue Sep 14, 2021 3:01 am

Re: How to interpret: Multiple faces ..... (updated)

Post by Sietse Achterop » Sat Dec 04, 2021 8:55 am

Sorry, stupid counting error in making the mesh. Forget it.
Attachments
brick2.stl.txt
Latest version of ascii stl file
(5.69 KiB) Downloaded 4 times
brick_corr.png
brick_corr.png (29.81 KiB) Viewed 137 times

POST REPLY