Tables¶
Objects can be added, deleted, and retrieved from a Model through tables.
The primary purpose of tables is to provide convenient access to specific subsets of objects (such as Layers, LineCurves, Meshes, Points, …). This is particularly useful when working with existing models, as it eliminates the need to inspect the type of every retrieved object.
Separate tables do not correspond to separate storage mechanisms in openNURBS. They exist solely as a convenience layer that provides a cleaner and more intuitive API.
All tables implement the following common API:
iterator support
addmethodcountmethoddeletemethodgetmethodget_exclusivemethod
The difference between the get and get_exclusive methods is that the
former returns a read-only view of the underlying object, whereas the latter
returns a modifiable object.
Refer also to chapter Access existing models.
LayerTable¶
The LayerTable class provides an interface to objects of type
ON_ModelComponent::Type::Layer.
Although these objects are typically accessed by ON_UUID (or index),
like other model objects, this table provides additional abstractions that
allow layers to be accessed by their full name using the format
parent::leaf.
Note that deleting the last layer and then adding a new one does not guarantee that layer ordering will be preserved.
LineCurveTable¶
The LineCurveTable class provides methods to manage ON_LineCurve
objects.
MeshTable¶
The MeshTable class provides methods to manage ON_Mesh objects.
PointTable¶
The PointTable class provides methods to manage ON_Point objects.