To make the Odb commands available to your script, the first thing you need to do is to import the odbAccess module:
from odbAccess import *
To access the model data, we need to be familiar with the structure of the model data object, as shown below:
As you can see, the "nodeSets" can be accessed either through part instances or through rootAssembly directly. Hence it will help make your script valid for general use if both scenarios are taken into account by your script.
It is relatively common to see scripts that access model data through part instances, with the following command statement:
odb.rootAssembly.instances[partName].nodeSets[nsetName].nodes
It is worth noting though, to do the same via rootAssembly directly, the following line is needed instead:
odb.rootAssembly.nodeSets[nsetName].nodes[0]
It has come to my attention that this may be a frequently asked question.
Comments