visualdynamics.core.entities¶
entities
¶
A geometry's entities, grouped the way the project tree lists them.
geometry.nodes, .coordinate_systems, .elements and .groups each
return a view: the same rows that can be expanded in the tree, available
to a script under the same names. A view reads the geometry's own arrays
and is 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
A column has its plural name on the view and its singular name on a
row: nodes.ids is every id, and nodes[3].id is one. Adding and
deleting are passed to the geometry's own methods, which keep ids unique
and make sure elements only refer to nodes that exist. All four kinds of
entity are deleted by id.
Classes:
| Name | Description |
|---|---|
EntityRow |
One node, coordinate system, element or element group of a geometry. |
EntityView |
One of a geometry's four kinds of entity, as rows and columns. |
Classes¶
EntityRow
¶
EntityRow(view: EntityView, row: int)
One node, coordinate system, element or element group of a geometry.
A row holds a row number, not the values, so it always reads and writes the geometry as it is now. If rows before it are deleted, it describes whatever entity moved into its position, so copy the values needed instead of keeping the row.
Attributes:
| Name | Type | Description |
|---|---|---|
row |
int
|
The index of this entity 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 kinds of entity, as rows and columns.
Returned by geometry.nodes, geometry.coordinate_systems,
geometry.elements and geometry.groups. Iterating gives one
EntityRow per entity. A column is read 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 entity through the geometry's own method. |
delete |
Delete entities by id, through the geometry's own method. |
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple[str, ...]
|
The plural names of this view's columns, in table order. |
Source code in src/visualdynamics/core/entities.py
Attributes¶
columns
property
¶
The plural names of this view's columns, in table order.
Methods:¶
add
¶
Add one entity through the geometry's own method.
The arguments and the return value are those of
Geometry.add_node, add_coordinate_system, add_element or
add_group: the new id, except for an element, which returns its
row index. Those methods keep ids unique and check that an
element's nodes exist.
Source code in src/visualdynamics/core/entities.py
delete
¶
Delete entities by id, through the geometry's own method.
Ids that are not present are ignored, so deleting twice is not an error.