visualdynamics.core.entities¶
entities
¶
A geometry's entities, grouped the way the project tree lists them.
geometry.nodes, .coordinate_systems, .tracelines, .elements and
.blocks each hand back a view: the same rows you can expand in the
tree, reachable from a script under the same names. A view is a window onto
the geometry's own arrays and never a copy of them, so writing through a
row writes into the geometry:
geometry.nodes[0].xyz = [0.0, 0.1, 0.0] # moves the node
geometry.nodes.xyz[:, 2] += 0.5 # and so does this
Columns keep their plural name on the view and their singular on a row —
nodes.ids is every id, nodes[3].id is one. Adding and deleting are
forwarded to the geometry, which is what keeps ids unique and
connectivity honest; everything is deleted by id, in every group.
Classes:
| Name | Description |
|---|---|
EntityRow |
One node, coordinate system, traceline or element, in place. |
EntityView |
One of a geometry's four groups of entities. |
Classes¶
EntityRow
¶
EntityRow(view: EntityView, row: int)
One node, coordinate system, traceline or element, in place.
Holds a row number rather than the values, so it reads and writes the geometry as it stands. Delete rows out from under one and it will be describing whatever moved up into its place — take the values you need rather than keeping the row.
Attributes:
| Name | Type | Description |
|---|---|---|
row |
int
|
Where this sits in the geometry's arrays. |
Source code in src/visualdynamics/core/entities.py
EntityView
¶
EntityView(geometry: Geometry, kind: str)
One of a geometry's four groups of entities.
Reached as geometry.nodes and friends. Iterating gives one
EntityRow per entity; a column is reached by its plural name and is
the geometry's own array, so slicing and assigning into it edit the
geometry in place.
Methods:
| Name | Description |
|---|---|
add |
Add one, by the geometry's rules — it keeps ids unique and |
delete |
Delete by id, in every group — an id names an entity here the |
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple[str, ...]
|
What this view can be asked for, in table order. |
Source code in src/visualdynamics/core/entities.py
Attributes¶
Methods:¶
add
¶
Add one, by the geometry's rules — it keeps ids unique and checks that connectivity names nodes that exist.
delete
¶
Delete by id, in every group — an id names an entity here the same way it does everywhere else. Ids that are not there are ignored, so deleting twice is not an error.