trussme 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
trussme-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Christopher C. McComb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ recursive-include tests *.py *.trs
trussme-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: trussme
3
+ Version: 0.1.0
4
+ Summary: Truss construction and analysis
5
+ Author-email: Christopher McComb <ccmcc2012@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/cmccomb/TrussMe
8
+ Project-URL: Source, https://github.com/cmccomb/TrussMe
9
+ Project-URL: Issues, https://github.com/cmccomb/TrussMe/issues
10
+ Keywords: truss,structural analysis,optimization,engineering
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: matplotlib
22
+ Requires-Dist: numpy
23
+ Requires-Dist: pandas
24
+ Requires-Dist: scipy
25
+ Requires-Dist: tabulate
26
+ Provides-Extra: dev
27
+ Requires-Dist: build>=1; extra == "dev"
28
+ Requires-Dist: pytest>=8; extra == "dev"
29
+ Requires-Dist: pytest-cov>=6; extra == "dev"
30
+ Requires-Dist: twine>=5; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # trussme
34
+
35
+ `trussme` is a Python library for building, analyzing, and optimizing truss structures.
36
+
37
+ ## Installation
38
+
39
+ `trussme` supports Python 3.10 and newer.
40
+
41
+ ```bash
42
+ pip install trussme
43
+ ```
44
+
45
+ The package depends on `numpy`, `scipy`, `pandas`, `matplotlib`, and `tabulate` at runtime.
46
+
47
+ ## Quick Start
48
+
49
+ ```python
50
+ import trussme
51
+
52
+ truss = trussme.Truss()
53
+ pin = truss.add_pinned_joint([0.0, 0.0, 0.0])
54
+ free = truss.add_free_joint([2.5, 2.5, 0.0])
55
+ roller = truss.add_roller_joint([5.0, 0.0, 0.0])
56
+
57
+ truss.add_member(pin, free)
58
+ truss.add_member(pin, roller)
59
+ truss.add_member(roller, free)
60
+
61
+ truss.add_out_of_plane_support("z")
62
+ truss.set_load(free, [0.0, -10000.0, 0.0])
63
+
64
+ truss.analyze()
65
+
66
+ print(truss.fos)
67
+ print(truss.mass)
68
+ ```
69
+
70
+ ## Built-in Materials
71
+
72
+ Trussme ships with a small library of common engineering materials. Each record
73
+ includes a `source` URL citing where the mechanical properties originate.
74
+
75
+ - A36_Steel - https://en.wikipedia.org/wiki/A36_steel
76
+ - A992_Steel - https://en.wikipedia.org/wiki/ASTM_A992
77
+ - 304_Stainless_Steel - https://en.wikipedia.org/wiki/SAE_304_stainless_steel
78
+ - 2024_T3_Aluminum - https://en.wikipedia.org/wiki/2024_aluminium_alloy
79
+ - 6061_T6_Aluminum - https://en.wikipedia.org/wiki/6061_aluminium_alloy
80
+ - 7075_T6_Aluminum - https://en.wikipedia.org/wiki/7075_aluminium_alloy
81
+ - Ti_6Al_4V_Titanium - https://en.wikipedia.org/wiki/Ti-6Al-4V
82
+
83
+ Custom materials must also provide a provenance `source` when added to a truss.
84
+
85
+ ## Project Links
86
+
87
+ - Source: [GitHub](https://github.com/cmccomb/TrussMe)
88
+ - Issues: [GitHub Issues](https://github.com/cmccomb/TrussMe/issues)
89
+ - Release Guide: [RELEASING.md](RELEASING.md)
90
+
91
+ ## License
92
+
93
+ This project is released under the MIT License.
@@ -0,0 +1,61 @@
1
+ # trussme
2
+
3
+ `trussme` is a Python library for building, analyzing, and optimizing truss structures.
4
+
5
+ ## Installation
6
+
7
+ `trussme` supports Python 3.10 and newer.
8
+
9
+ ```bash
10
+ pip install trussme
11
+ ```
12
+
13
+ The package depends on `numpy`, `scipy`, `pandas`, `matplotlib`, and `tabulate` at runtime.
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ import trussme
19
+
20
+ truss = trussme.Truss()
21
+ pin = truss.add_pinned_joint([0.0, 0.0, 0.0])
22
+ free = truss.add_free_joint([2.5, 2.5, 0.0])
23
+ roller = truss.add_roller_joint([5.0, 0.0, 0.0])
24
+
25
+ truss.add_member(pin, free)
26
+ truss.add_member(pin, roller)
27
+ truss.add_member(roller, free)
28
+
29
+ truss.add_out_of_plane_support("z")
30
+ truss.set_load(free, [0.0, -10000.0, 0.0])
31
+
32
+ truss.analyze()
33
+
34
+ print(truss.fos)
35
+ print(truss.mass)
36
+ ```
37
+
38
+ ## Built-in Materials
39
+
40
+ Trussme ships with a small library of common engineering materials. Each record
41
+ includes a `source` URL citing where the mechanical properties originate.
42
+
43
+ - A36_Steel - https://en.wikipedia.org/wiki/A36_steel
44
+ - A992_Steel - https://en.wikipedia.org/wiki/ASTM_A992
45
+ - 304_Stainless_Steel - https://en.wikipedia.org/wiki/SAE_304_stainless_steel
46
+ - 2024_T3_Aluminum - https://en.wikipedia.org/wiki/2024_aluminium_alloy
47
+ - 6061_T6_Aluminum - https://en.wikipedia.org/wiki/6061_aluminium_alloy
48
+ - 7075_T6_Aluminum - https://en.wikipedia.org/wiki/7075_aluminium_alloy
49
+ - Ti_6Al_4V_Titanium - https://en.wikipedia.org/wiki/Ti-6Al-4V
50
+
51
+ Custom materials must also provide a provenance `source` when added to a truss.
52
+
53
+ ## Project Links
54
+
55
+ - Source: [GitHub](https://github.com/cmccomb/TrussMe)
56
+ - Issues: [GitHub Issues](https://github.com/cmccomb/TrussMe/issues)
57
+ - Release Guide: [RELEASING.md](RELEASING.md)
58
+
59
+ ## License
60
+
61
+ This project is released under the MIT License.
@@ -0,0 +1,64 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "trussme"
7
+ dynamic = ["version"]
8
+ description = "Truss construction and analysis"
9
+ readme = { file = "README.md", content-type = "text/markdown" }
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "Christopher McComb", email = "ccmcc2012@gmail.com" },
14
+ ]
15
+ keywords = ["truss", "structural analysis", "optimization", "engineering"]
16
+ classifiers = [
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Scientific/Engineering",
24
+ ]
25
+ dependencies = [
26
+ "matplotlib",
27
+ "numpy",
28
+ "pandas",
29
+ "scipy",
30
+ "tabulate",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/cmccomb/TrussMe"
35
+ Source = "https://github.com/cmccomb/TrussMe"
36
+ Issues = "https://github.com/cmccomb/TrussMe/issues"
37
+
38
+ [project.optional-dependencies]
39
+ dev = [
40
+ "build>=1",
41
+ "pytest>=8",
42
+ "pytest-cov>=6",
43
+ "twine>=5",
44
+ ]
45
+
46
+ [tool.setuptools.dynamic]
47
+ version = { attr = "trussme._version.__version__" }
48
+
49
+ [tool.setuptools.packages.find]
50
+ include = ["trussme*"]
51
+
52
+ [tool.pytest.ini_options]
53
+ addopts = "--cov=trussme --cov-report=term-missing --cov-report=xml --cov-fail-under=85"
54
+ markers = [
55
+ "slow: long-running optimization tests",
56
+ ]
57
+ testpaths = ["tests"]
58
+
59
+ [tool.coverage.run]
60
+ source = ["trussme"]
61
+
62
+ [tool.coverage.report]
63
+ show_missing = true
64
+ skip_covered = false
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,50 @@
1
+ # This file defines parameters for a truss. All columns are tab delimited.
2
+ # Joints, members, and materials can be included in any order, and lines
3
+ # beginning with a "#" symbol are ignored.
4
+
5
+ # This block defines materials used in subsequent member definitions. The
6
+ # order of hte columns is:
7
+ # S name, density, elastic modulus, yield strength, source
8
+ S A36_Steel 7850.0 200_000_000_000.0 250_000_000.0 https://en.wikipedia.org/wiki/A36_steel
9
+
10
+ # This block defines joints. The order of the columns is
11
+ # J X-coord, Y-coord, Z-coord, X-support, Y-support, Z-support
12
+ J 0.0 0.0 0.0 1 1 1
13
+ J 1.0 0.0 0.0 0 0 1
14
+ J 2.0 0.0 0.0 0 0 1
15
+ J 3.0 0.0 0.0 0 0 1
16
+ J 4.0 0.0 0.0 0 0 1
17
+ J 5.0 0.0 0.0 1 1 1
18
+ J 0.5 1.0 0.0 0 0 1
19
+ J 1.5 1.0 0.0 0 0 1
20
+ J 2.5 1.0 0.0 0 0 1
21
+ J 3.5 1.0 0.0 0 0 1
22
+ J 4.5 1.0 0.0 0 0 1
23
+
24
+ # This block defines members. The order of the columns is
25
+ # M joint1, joint2, material, shape, {parameters for shape, t=X, etc.}
26
+ M 0 1 A36_Steel pipe r=0.02 t=0.002
27
+ M 1 2 A36_Steel pipe r=0.02 t=0.002
28
+ M 2 3 A36_Steel pipe r=0.02 t=0.002
29
+ M 3 4 A36_Steel pipe r=0.02 t=0.002
30
+ M 4 5 A36_Steel pipe r=0.02 t=0.002
31
+ M 6 7 A36_Steel pipe r=0.02 t=0.002
32
+ M 7 8 A36_Steel pipe r=0.02 t=0.002
33
+ M 8 9 A36_Steel pipe r=0.02 t=0.002
34
+ M 9 10 A36_Steel pipe r=0.02 t=0.002
35
+ M 0 6 A36_Steel pipe r=0.02 t=0.002
36
+ M 6 1 A36_Steel pipe r=0.02 t=0.002
37
+ M 1 7 A36_Steel pipe r=0.02 t=0.002
38
+ M 7 2 A36_Steel pipe r=0.02 t=0.002
39
+ M 2 8 A36_Steel pipe r=0.02 t=0.002
40
+ M 8 3 A36_Steel pipe r=0.02 t=0.002
41
+ M 3 9 A36_Steel pipe r=0.02 t=0.002
42
+ M 9 4 A36_Steel pipe r=0.02 t=0.002
43
+ M 4 10 A36_Steel pipe r=0.02 t=0.002
44
+ M 10 5 A36_Steel pipe r=0.02 t=0.002
45
+
46
+ # This block defines loads. The order of the columns is:
47
+ # L joint, x-load, y-load, z-load
48
+ L 7 0 -20000 0
49
+ L 8 0 -20000 0
50
+ L 9 0 -20000 0
@@ -0,0 +1,87 @@
1
+ from pathlib import Path
2
+
3
+ import trussme
4
+
5
+
6
+ TEST_TRUSS_FILENAME = Path(__file__).with_name("example.trs")
7
+
8
+
9
+ def default_goals() -> trussme.Goals:
10
+ return trussme.Goals(
11
+ minimum_fos_buckling=1.5,
12
+ minimum_fos_yielding=1.5,
13
+ maximum_mass=5.0,
14
+ maximum_deflection=6e-3,
15
+ )
16
+
17
+
18
+ def build_reference_truss() -> trussme.Truss:
19
+ truss = trussme.Truss()
20
+ truss.add_pinned_joint([0.0, 0.0, 0.0])
21
+ truss.add_free_joint([1.0, 0.0, 0.0])
22
+ truss.add_free_joint([2.0, 0.0, 0.0])
23
+ truss.add_free_joint([3.0, 0.0, 0.0])
24
+ truss.add_free_joint([4.0, 0.0, 0.0])
25
+ truss.add_pinned_joint([5.0, 0.0, 0.0])
26
+
27
+ truss.add_free_joint([0.5, 1.0, 0.0])
28
+ truss.add_free_joint([1.5, 1.0, 0.0])
29
+ truss.add_free_joint([2.5, 1.0, 0.0])
30
+ truss.add_free_joint([3.5, 1.0, 0.0])
31
+ truss.add_free_joint([4.5, 1.0, 0.0])
32
+
33
+ truss.add_out_of_plane_support("z")
34
+
35
+ truss.joints[7].loads[1] = -20000
36
+ truss.joints[8].loads[1] = -20000
37
+ truss.joints[9].loads[1] = -20000
38
+
39
+ for start, end in (
40
+ (0, 1),
41
+ (1, 2),
42
+ (2, 3),
43
+ (3, 4),
44
+ (4, 5),
45
+ (6, 7),
46
+ (7, 8),
47
+ (8, 9),
48
+ (9, 10),
49
+ (0, 6),
50
+ (6, 1),
51
+ (1, 7),
52
+ (7, 2),
53
+ (2, 8),
54
+ (8, 3),
55
+ (3, 9),
56
+ (9, 4),
57
+ (4, 10),
58
+ (10, 5),
59
+ ):
60
+ truss.add_member(start, end)
61
+
62
+ return truss
63
+
64
+
65
+ def build_optimization_truss() -> trussme.Truss:
66
+ truss = build_reference_truss()
67
+ truss.joints[7].loads[1] = 0.0
68
+ truss.joints[9].loads[1] = 0.0
69
+ return truss
70
+
71
+
72
+ def build_triangle_truss(shape=None) -> trussme.Truss:
73
+ truss = trussme.Truss()
74
+ pin = truss.add_pinned_joint([0.0, 0.0, 0.0])
75
+ free = truss.add_free_joint([2.5, 2.5, 0.0])
76
+ roller = truss.add_roller_joint([5.0, 0.0, 0.0])
77
+
78
+ truss.add_out_of_plane_support("z")
79
+ truss.set_load(free, [0.0, -10000.0, 0.0])
80
+
81
+ for start, end in ((pin, free), (pin, roller), (roller, free)):
82
+ if shape is None:
83
+ truss.add_member(start, end)
84
+ else:
85
+ truss.add_member(start, end, shape=shape())
86
+
87
+ return truss
@@ -0,0 +1,73 @@
1
+ import doctest
2
+
3
+ import pytest
4
+
5
+ import trussme
6
+ import trussme.components
7
+ import trussme.report
8
+ import trussme.truss
9
+
10
+ from tests.helpers import TEST_TRUSS_FILENAME, build_reference_truss, default_goals
11
+
12
+
13
+ @pytest.mark.parametrize(
14
+ "module",
15
+ [trussme, trussme.truss, trussme.components, trussme.report],
16
+ )
17
+ def test_doctests(module) -> None:
18
+ failed, _ = doctest.testmod(module, optionflags=doctest.ELLIPSIS)
19
+ assert failed == 0
20
+
21
+
22
+ def test_build_methods() -> None:
23
+ goals = default_goals()
24
+ truss_from_commands = build_reference_truss()
25
+ truss_from_file = trussme.read_trs(str(TEST_TRUSS_FILENAME))
26
+
27
+ assert trussme.report_to_str(
28
+ truss_from_file,
29
+ goals,
30
+ with_figures=False,
31
+ ) == trussme.report_to_str(
32
+ truss_from_commands,
33
+ goals,
34
+ with_figures=False,
35
+ )
36
+
37
+
38
+ def test_save_to_trs_and_rebuild(tmp_path) -> None:
39
+ goals = default_goals()
40
+ truss_from_file = trussme.read_trs(str(TEST_TRUSS_FILENAME))
41
+ output_path = tmp_path / "saved.trs"
42
+
43
+ truss_from_file.to_trs(str(output_path))
44
+ truss_rebuilt_from_file = trussme.read_trs(str(output_path))
45
+
46
+ assert trussme.report_to_str(
47
+ truss_from_file,
48
+ goals,
49
+ with_figures=False,
50
+ ) == trussme.report_to_str(
51
+ truss_rebuilt_from_file,
52
+ goals,
53
+ with_figures=False,
54
+ )
55
+
56
+
57
+ def test_save_to_json_and_rebuild(tmp_path) -> None:
58
+ goals = default_goals()
59
+ truss_from_file = trussme.read_trs(str(TEST_TRUSS_FILENAME))
60
+ output_path = tmp_path / "saved.json"
61
+
62
+ truss_from_file.to_json(str(output_path))
63
+ truss_rebuilt_from_file = trussme.read_json(str(output_path))
64
+
65
+ assert trussme.report_to_str(
66
+ truss_from_file,
67
+ goals,
68
+ with_figures=False,
69
+ ) == trussme.report_to_str(
70
+ truss_rebuilt_from_file,
71
+ goals,
72
+ with_figures=False,
73
+ )
@@ -0,0 +1,64 @@
1
+ import unittest
2
+
3
+ import trussme
4
+
5
+
6
+ class TestCustomStuff(unittest.TestCase):
7
+ def test_custom_material(self):
8
+ # Build truss from scratch
9
+ truss = trussme.Truss()
10
+ truss.add_pinned_joint([0.0, 0.0, 0.0])
11
+ truss.add_free_joint([2.5, 2.5, 0.0])
12
+ truss.add_roller_joint([5.0, 0.0, 0.0])
13
+
14
+ truss.add_out_of_plane_support("z")
15
+
16
+ truss.joints[1].loads[1] = -20000
17
+
18
+ unobtanium: trussme.Material = {
19
+ "name": "unobtanium",
20
+ "yield_strength": 200_000_000_000,
21
+ "elastic_modulus": 200_000_000_000_000.0,
22
+ "density": 1_000.0,
23
+ "source": "https://en.wikipedia.org/wiki/Unobtainium",
24
+ }
25
+
26
+ truss.add_member(0, 1, material=unobtanium)
27
+ truss.add_member(1, 2, material=unobtanium)
28
+ truss.add_member(2, 0, material=unobtanium)
29
+
30
+ truss.analyze()
31
+
32
+ self.assertIsNotNone(truss.fos)
33
+
34
+ def test_custom_shape(self):
35
+ # Build truss from scratch
36
+ truss = trussme.Truss()
37
+ truss.add_pinned_joint([0.0, 0.0, 0.0])
38
+ truss.add_free_joint([2.5, 2.5, 0.0])
39
+ truss.add_roller_joint([5.0, 0.0, 0.0])
40
+
41
+ truss.add_out_of_plane_support("z")
42
+
43
+ truss.joints[1].loads[1] = -20000
44
+
45
+ class MagicalRod(trussme.Shape):
46
+ def __init__(self):
47
+ self._params = {}
48
+
49
+ def moi(self) -> float:
50
+ return 200_000_000_000
51
+
52
+ def area(self) -> float:
53
+ return 100_000
54
+
55
+ def name(self) -> str:
56
+ return "magical rod"
57
+
58
+ truss.add_member(0, 1, shape=MagicalRod())
59
+ truss.add_member(1, 2, shape=MagicalRod())
60
+ truss.add_member(2, 0, shape=MagicalRod())
61
+
62
+ truss.analyze()
63
+
64
+ self.assertIsNotNone(truss.fos)
@@ -0,0 +1,43 @@
1
+ """Tests for built-in material sources.
2
+
3
+ These tests ensure every material in ``MATERIAL_LIBRARY`` specifies a
4
+ source URL so that property data can be traced back to its origin.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from urllib.parse import urlparse
10
+
11
+ from trussme.components import MATERIAL_LIBRARY
12
+
13
+
14
+ def test_every_material_has_source() -> None:
15
+ """Each material should define a non-empty ``source`` URL."""
16
+
17
+ # Act
18
+ sources = [material.get("source", "") for material in MATERIAL_LIBRARY]
19
+
20
+ # Assert
21
+ for source in sources:
22
+ parsed = urlparse(source)
23
+ assert parsed.scheme in {"http", "https"}
24
+ assert parsed.netloc
25
+
26
+
27
+ def test_common_materials_present() -> None:
28
+ """Selected materials should ship with the library."""
29
+
30
+ # Arrange
31
+ expected = {
32
+ "A36_Steel",
33
+ "A992_Steel",
34
+ "6061_T6_Aluminum",
35
+ "7075_T6_Aluminum",
36
+ "304_Stainless_Steel",
37
+ }
38
+
39
+ # Act
40
+ names = {material["name"] for material in MATERIAL_LIBRARY}
41
+
42
+ # Assert
43
+ assert expected.issubset(names)
@@ -0,0 +1,41 @@
1
+ """Tests for member addition functions."""
2
+
3
+ import trussme
4
+ import pytest
5
+
6
+
7
+ def test_add_member_returns_index() -> None:
8
+ """Ensure ``add_member`` returns the new member index."""
9
+ # Arrange
10
+ truss = trussme.Truss()
11
+ start = truss.add_free_joint([0.0, 0.0, 0.0])
12
+ end = truss.add_free_joint([1.0, 0.0, 0.0])
13
+
14
+ # Act
15
+ idx = truss.add_member(start, end)
16
+
17
+ # Assert
18
+ assert idx == 0
19
+
20
+
21
+ def test_add_member_invalid_index() -> None:
22
+ """``add_member`` should raise when given an invalid joint index."""
23
+ # Arrange
24
+ truss = trussme.Truss()
25
+ valid = truss.add_free_joint([0.0, 0.0, 0.0])
26
+ _ = truss.add_free_joint([1.0, 0.0, 0.0])
27
+
28
+ # Act / Assert
29
+ with pytest.raises(IndexError):
30
+ truss.add_member(5, valid)
31
+
32
+
33
+ def test_add_member_identical_indices() -> None:
34
+ """``add_member`` rejects using the same joint for both ends."""
35
+ # Arrange
36
+ truss = trussme.Truss()
37
+ joint = truss.add_free_joint([0.0, 0.0, 0.0])
38
+
39
+ # Act / Assert
40
+ with pytest.raises(ValueError):
41
+ truss.add_member(joint, joint)