I would like to bring to your attention an orror on AddMesh method that has appeared with rhino7. The error does’nt exist in rhino5.
Some more description
strMesh = rhino.AddMesh(arrNode, arrFace) gives (strMesh = Null) answer.
It is important here to specifiy that
arrNode is a list of for example 1000 points,
arrFace is a list of for example 1000 faces, but only the first 600 faces (for example) are valid, and after that the remaining 400 faces are array(0,0,0,0), so they all refer to the same point arrNode(0), which happens to be array(0,0,0).
This wasn’t a problem with rhino5, but it is now with rhino7. We would be very glad that the problem is fixed, because it is quite important for our internal engineering plug-in.
An image to picture what kinf of meshes we are talking about :
It is important for us that it works, as we create thousands of such meshes with rhinoscript from vertices and faces lists stored in TXT files. And we use for each of them the same initialization of arrPoints() and arrFaces() lists. Therefore we end up with such lists, containing at the end a cartain number of faces equal to (0,0,0,0). In rhino5, this was no problem, as the AddMesh function simply ignores thoses faces. But it is a problem with rhino7. It would be great if this could be fixed.
I can repeat the issue, but I don’t have a way of making your existing code work. Unlike Rhino 5, newer version of Rhino are not as tolerant of invalid meshes. The degenerate faces, in your code are the problem.
I am using dataTrees in order to store my data. If I want the meshes to contain only valid faces (and no degenerate ones), I have to resize the data tree branches after data import. For example :
All meshes faces are stored in a data tree that initializes before data import, for example :
myFacesTree(iMesh, 0 to 1000)(jFace, 0 to 1000)(kVertice, 0 to 2)
After data import, I know for example that mesh 2 has only 500 valid vertices, and I would like to resize memory using :
Redim preserve myFacesTree(2)(500)
But VBScript does not allow such memory resizing (only the last branch of the tree is allowed).
How should I proceed ?
PS : maybe I can add an “extract valid faces” function, just at the time I want to draw the mesh ? For instance for the above example of mesh 2 :
My apologies, but I do not know enough about your project to make an suggestions.
If I understand, correctly, you have a text file that contains meshes (vertices and faces) and you are trying to read this text file with RhinoScript and create the meshes in Rhino. Is this true? If so, could I have a look at one of these files - perhaps I can suggest an alternative method for reading and creating meshes. Feel free to send me a PM if needed.