2011/7/3 Benjamin Turner <bpltur...@gmail.com> > Hello, > > I found an example of how to traverse a mesh generated by SMESH module at: > http://code.google.com/p/pythonocc/source/browse/trunk/src/samples/Level1/SMESH/traverse_mesh.py > > I borrowed part of the code and am trying to use it to print the (x, y, z) > coordinates of every node in an edge. Most of the ones I've generated are > simply lines. I've searched the C++ wrapper for SMESH, but I'm unable to > find a way to iterate through the nodes that make up an edge. > > Here is the code I've borrowed: > > print "Results:" > print "Nb Nodes", mesh_ds.NbNodes() > print "Nb Edges", mesh_ds.NbEdges() > print "Nb Faces", mesh_ds.NbFaces() > > for i in range(mesh_ds.NbNodes()-1): > node = mesh_ds.nodeValue(i) > print 'Coordinates of node %i:(%f,%f,%f)'%(i, node.X(), node.Y(), > node.Z()) > > for i in range(mesh_ds.NbEdges()-1): > edge = mesh_ds.edgeValue(i) > print 'Edge %i: connected to %i nodes, shared between %i > faces'%(i,edge.NbNodes(),edge.NbFaces())#,dir(edge) > > Now, I'm actually trying to find the X, Y and Z values of each node that > makes up the edges as I iterate through them. However, I'm unable to find a > function that allows me to get either the index of the nodes that form the > edge, or a way to hold each node of an edge as I iterate through them to > grab their X, Y and Z. >
Hi Benjamin, You can try the FindNodeIndex method of the class SMDS_MeshEdge returned by mesh_ds.edgeValue(i). > > Could someone assist me? > > Thanks. > > Regards, > > Benjamin P. L. Turner > bpltur...@gatech.edu > > Regards, Thomas
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users