Hello there :) , I am a python newbie who needs help with tables(lists?) and other data structures. My mechanical engineering simulation program (Abaqus) use a Python env to access model data and results from a simulation. For me a model means a "mesh" of that model, i.e. a lists of nodes and elements which discretized the CAD model. In Abaqus each mesh has the following structure (see " http://www.tecnopolis.eu/upload/mesh.inp"):
- a list of NODES in form of a table ( nodelabel_n, coordinatex, coordinatey) - and a list of ELEMENTS also in form of a table. Each element refers to three nodes (which must be in the list of nodes) and the table looks like this (elementlabel_n, node_n1, node_n2, node_n3) Through following py script I can access all nodes (--> *N*) and elements (--> *EL*) from the "mesh-1.odb" file ( http://www.tecnopolis.eu/upload/mesh-1.odb) where the simulation results are stored. *from odbAccess import * from odbSection import * nameodb = 'mesh-1' path = '/onepath/' + nameodb + '.odb' odb = openOdb(path) **N = odb.rootAssembly.instances['PART-1-1'].nodes * *EL = odb.rootAssembly.instances['PART-1-1'].elements * Info: to get a node label, for example the label of the node object n5 in the list Ntop: *Ntop[5].label* to get the x coordinates of that node: *Ntop[5].coordinates[0]* In particular I am interested in the node subset "TOP" (which represents all the nodes at the top of my model) *Ntop = odb.rootAssembly.instances['PART-1-1'].nodeSets['TOP'].nodes * Problem: 1) the list of nodes Ntop contains all the node labels [2673, 2675, 2676, 2677, 2678, 3655, 3656, 119939, 124154, 127919] already ordered in ascending order. What I need is the same list *ordered by coordinate_x* of each node, i.e. from left to right in the model (unfortunately, for example node 124154 cames before node 3656 in the model, if you read the model from left to right) 1b) I don't understand which kind of data are EL, N, Ntop (list?) and how can I sort Ntop with the criterium based on coordinate_x (coordinate[0]) Many thanks, Alex -- > Alessandro Zivelonghi > > http://www.tecnopolis.eu > > skype: alexzive > > "Energy and persistence conquer all things." > Benjamin Franklin (1706 - 1790) >
-- http://mail.python.org/mailman/listinfo/python-list