# Reordering elements by xi

- In cmgui you can reorder nodes and elements by any field, such as the x
- coordinate 'gfx change_identifier element_offset 1 sort_by coordinates.x'.
- If you want to use your xi directions to reorder then use computed fields to
build up a new ordering from an xi_texture_coordinate field. Unfortunately you cannot use this to reorder your nodes, just your elements. To do this you start with a seed element from which the xi_texture_coordinates will spread out. This example is for 2D elements so there are 2 components. The weights in the second field are to ensure that xi2 varies faster than xi1 (There are 8 elements in the xi2 direction).

gfx define field renumber_1 xi_texture_coordinates seed_element 5; gfx define field renumber sum_components field renumber_1 weights 8 1; gfx change_id element_offset 1 sort_by renumber