""" - script to create a path based on a node set and a set with the start node - sets need to be defined on assembly level - open odb in abaqus cae and run script - to check see Tools > Path > Manager afterwards """ # to be defined by user in preprocessing set_nodes = 'path-edge' # set with the edge where the path should be set_startnode = 'path-start' # set with point of that edge to indicate start of path pathname = 'Path-x' # name of the path that is created by this script ## set_nodes = set_nodes.upper() set_startnode = set_startnode.upper() from abaqus import * from abaqusConstants import * from caeModules import * from math import * dict_nodes ={} list_nodes = [] vps = session.viewports.values()[0] odbName = vps.displayedObject.name odb = session.odbs[odbName] instancename = odb.rootAssembly.nodeSets[set_startnode].nodes[0][0].instanceName coord_point = odb.rootAssembly.nodeSets[set_startnode].nodes[0][0].coordinates for node in odb.rootAssembly.nodeSets[set_nodes].nodes[0]: dist = sqrt((pow(node.coordinates[0]-coord_point[0],2))+ \ (pow(node.coordinates[1]-coord_point[1],2))+ \ (pow(node.coordinates[2]-coord_point[2],2))) dict_nodes[dist] = node.label x = dict_nodes.keys() x.sort() for y in x: list_nodes.append(dict_nodes[y]) list_nodes = tuple(list_nodes) session.Path(name=pathname, type=NODE_LIST, expression=((instancename, ( list_nodes)), )) print '\nPath was created'