Can someone point me to an example of pulling vertices from faces obtained from AssociationDef?

@RHMoore Sorry this slipped off my radar.

Once you have a model entity of interest selected in python (i.e., the SMTK face, like face..bcc2), you can get to the VTK data like so:

from vtkmodules.util.numpy_support import vtk_to_numpy as vton
# Fetch the session object from the resource that owns the face of interest:
session = face.resource().session()
# Fetch the VTK object from the session by passing the UUID of the face:
faceData = session.findStorage(face.id())
# The VTK object may be vtkPolyData, vtkUnstructuredGrid, or vtkImageData
# and in any case should have global cell and point IDs.
cellIds = vton(faceData.GetCellData().GetGlobalIds())
nodeIds = vton(faceData.GetPointData().GetGlobalIds())
# If you want the locations of points in space, you can get those, too:
nodeCoords = vton(faceData.GetPoints().GetData())
# Finally, you many need connectivity information about which offsets into the
# nodeIds and nodeCoords a given cell  references. This is different for
# vtkPolyData vs vtkUnstructuredGrid vs vtkImageData. For polydata, if you
# are interested in surface elements (triangles, quads), then
off = vton(faceData.GetPolys().GetOffsetsArray())
conn = vton(faceData.GetPolys().GetConnectivityArray())
# The "off" array is of length N+1, where N is the number of cells
# and each value an offset into the connectivity array "conn".
# The "conn" array holds offsets into all the point arrays (nodeIds, nodeCoords).

So, if you are interested in the nodes of cell 10, you can see how many nodes it has with numNodes = off[11] - off[10] and then get global point IDs

pointIdsOfCell10 = [nodeIds[ii] for ii in conn[off[10]:off[10+1]]]

Similarly, for point locations

pointsOfCell10 = [nodeCoords[ii,:] for ii in conn[off[10]:off[10+1]]]

NB: For the benefit of others, this reading this later, these instructions work for sessions based on smtk::model::Resource such as smtk::session::vtk or smtk::session::aeva. Other sessions such as opencascade don’t have VTK data backing model entities.