Skip to content

Commit 90aef63

Browse files
Merge pull request #429 from robbievanleeuwen/angle-section-fix
Fix angle_section bug when the toe thickness equals the section thickness
2 parents 5d43ea3 + b1cf0eb commit 90aef63

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[flake8]
22
select = B,B9,C,D,DAR,E,F,N,PT,RST,S,W
3-
ignore = B028,B905,E203,E501,E741,RST201,RST203,RST301,RST303,W503
3+
ignore = B028,B905,B908,E203,E501,E741,RST201,RST203,RST301,RST303,W503
44
max-line-length = 80
55
docstring-convention = google
66
per-file-ignores = tests/*:S101,__init__.py:F401,post.py:C901

src/sectionproperties/pre/library/steel_sections.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ def angle_section(
985985
Angle section geometry
986986
987987
Raises:
988-
ValueError: If the toe radius is larger than the toe thickness
988+
ValueError: If the toe radius is larger than the thickness
989989
990990
Example:
991991
The following example creates an angle section with a depth of 150 mm, a width
@@ -1002,14 +1002,16 @@ def angle_section(
10021002
"""
10031003
if r_t > t:
10041004
raise ValueError(
1005-
"The radius of the toe (r_t) cannot be larger than the toe thickness (t)."
1005+
"The radius of the toe (r_t) cannot be larger than the thickness (t)."
10061006
)
10071007

10081008
points: list[tuple[float, float]] = []
10091009

1010-
# add first two points
1010+
# add first two points, but don't add second if the toe radius equals the thickness
10111011
points.append((0, 0))
1012-
points.append((b, 0))
1012+
1013+
if not np.isclose(t, r_t):
1014+
points.append((b, 0))
10131015

10141016
# construct the bottom toe radius
10151017
pt = b - r_t, t - r_t
@@ -1023,8 +1025,9 @@ def angle_section(
10231025
pt = t - r_t, d - r_t
10241026
points += sp_utils.draw_radius(pt=pt, r=r_t, theta=0, n=n_r)
10251027

1026-
# add the next point
1027-
points.append((0, d))
1028+
# add the last point, only if the toe radius does not equal the thickness
1029+
if not np.isclose(t, r_t):
1030+
points.append((0, d))
10281031

10291032
polygon = Polygon(points)
10301033

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Tests for the steel sections library."""
2+
3+
from __future__ import annotations
4+
5+
import warnings
6+
7+
import pytest
8+
9+
import sectionproperties.pre.library.steel_sections as ss
10+
from sectionproperties.analysis import Section
11+
12+
13+
def test_angle_section_toe_thickness():
14+
"""Tests the angle section when the toe thickness equals the thickness."""
15+
geom = ss.angle_section(d=20, b=20, t=3, r_r=3.5, r_t=3, n_r=16)
16+
geom.create_mesh(mesh_sizes=1.0)
17+
sec = Section(geom)
18+
19+
# check for no additional warnings
20+
with pytest.warns() as record:
21+
warnings.warn("user", UserWarning)
22+
sec.calculate_geometric_properties()
23+
sec.calculate_warping_properties()
24+
25+
assert len(record) == 1

0 commit comments

Comments
 (0)