top of page
Search

Sorting nodes from a Node Set

  • Writer: Philip Dai
    Philip Dai
  • 2 hours ago
  • 1 min read

Asked Copilot "abaqus python sort node list based on x coordinate"


Got a number of answers, actually quite useful i.e., this process tends to eliminate the need to read Abaqus manual.


This is one of the useful answers that easy to adopt.


p = mdb.models['Model-1'].parts['Part-1']

nset = p.nodeSets['MY_SET']  # or getSetFromNodeLabels, etc.


# create a list of nodes objects sorted by X coordinates

nodes_sorted = sorted(nset.nodes, key=lambda n: n.coordinates[0])


labels_sorted = [n.label for n in nodes_sorted]


for e, c in enumerate(nodes_sorted):

#

nodal_number = c.label # or nodes_sorted[e].label

  x = c.coordinates[0] # undeformed

y = c.coordinates[1] # undeformed

z = c.coordinates[2] # undeformed


#

disp_field = f.fieldOutputs["U"]

my_sub_field = disp_field.getSubset(region=nset)

disp = my_sub_field.values

for e, c in enumerate(disp):

c1 = c.data

u1 = c1[0]

v1 = c1[1]

w1 = c1[2]


# set up the frame and field variables

step_and_frame = f

try:

fv_field = step_and_frame.FieldOutput(

name=field_name, description="", type=SCALAR

)

fv_field.addData(

position=NODAL, instance=thisInstance, labels=fv-x, data=fv-y

) # scalar x and y

print("... field variables %s appended to Odb %s" % (field_name, odb))

except:

print("... field %s already exists" % (field_name))

#



 
 
 

Recent Posts

See All
Rigid beam elements and connector element

The Abaqus element type RB3D2 is a two-node, three-dimensional rigid beam element used to model components that do not deform .  It is frequently used in Abaqus/Standard, particularly in the modeling

 
 
 

1 Comment


Philip Dai
Philip Dai
an hour ago
Like

©2020 by TF Analysis. Proudly created with Wix.com

bottom of page