Import the required modules: #include <iostream.h> #include <odb_API.h> Open the output database used by the tutorial. odb_Odb& odb = openOdb("viewer_tutorial.odb");
Create a variable that refers to the last frame of the first step.
odb_Step& step = odb.steps()["Step-1"];
odb_SequenceFrame& allFramesInStep = step.frames();
int numFrames = allFramesInStep.size();
odb_Frame& lastFrame = allFramesInStep[numFrames-1];
Create a variable that refers to the displacement 'U' in the last frame of the first step. odb_FieldOutput& displacements = lastFrame.fieldOutputs().get("U"); Create a variable that refers to the node set 'PUNCH' in the part instance'PART-1–1' : odb_Instance& instance = odb.rootAssembly().instances()["PART-1-1"]; odb_Set& nodeSet = instance.nodeSets()["PUNCH"]; Create a variable that refers to the displacement of the node set in the last frame of the first step: odb_FieldOutput myDisplacements = displacements.getSubset(nodeSet); Finally, print some field output data from each node in the node set (a single node in this example). const odb_FieldValue val = myDisplacements.values()[0]; const float* const data = val.data(numComp); cout << " Node: " << val.nodeLabel() << endl; cout << " U = "; for (int comp=0;comp<numComp;comp++) cout << data[comp] << " "; cout << endl; cout << " Magnitude = " << val.magnitude(); The resulting output is Node : 1000 U = 0.0000 , -76.4554 Magnitude = 76.4554 |