diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b2b78f9..564b043a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* Added `compas_tna.diagrams.FormDiagram.from_mesh`. + ### Changed ### Removed - ## [0.4.0] 2024-03-01 ### Added @@ -22,7 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.3.0] 2024-02-09 ### Added @@ -31,7 +31,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.2.0] 2022-12-02 ### Added diff --git a/src/compas_tna/diagrams/formdiagram.py b/src/compas_tna/diagrams/formdiagram.py index e8a973c6..0cd5760c 100644 --- a/src/compas_tna/diagrams/formdiagram.py +++ b/src/compas_tna/diagrams/formdiagram.py @@ -149,6 +149,22 @@ def from_lines(cls, lines, delete_boundary_face=True, precision=None, **kwargs): form.name = kwargs["name"] return form + @classmethod + def from_mesh(cls, mesh): + """Construct a Form Diagram from another mesh. + + Parameters + ---------- + mesh : :class:`compas.datastructures.Mesh` + The other mesh. + + Returns + ------- + :class:`compas_tna.diagrams.FormDiagram` + + """ + return mesh.copy(cls=cls) + def uv_index(self): """Returns a dictionary that maps edge keys (i.e. pairs of vertex keys) to the corresponding edge index in a list or array of edges.