Skip to content

Commit 3b1698c

Browse files
Fix lip length issues with Cee and Zed sections
1 parent 10ab90e commit 3b1698c

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

sectionproperties/pre/sections.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,6 +1805,7 @@ class CeeSection(Geometry):
18051805
:param int n_r: Number of points discretising the outer radius
18061806
:param shift: Vector that shifts the cross-section by *(x, y)*
18071807
:type shift: list[float, float]
1808+
:raises Exception: Lip length must be greater than the outer radius
18081809
18091810
The following example creates a Cee section with a depth of 125, a width
18101811
of 50, a lip of 30, a thickness of 1.5 and an outer radius of 6, using 8
@@ -1830,6 +1831,10 @@ class CeeSection(Geometry):
18301831
def __init__(self, d, b, l, t, r_out, n_r, shift=[0, 0]):
18311832
"""Inits the CeeSection class."""
18321833

1834+
# ensure the lip length is greater than the outer radius
1835+
if l < r_out:
1836+
raise Exception('Lip length must be greater than the outer radius')
1837+
18331838
# assign control point
18341839
control_points = [[t * 0.5, d * 0.5]]
18351840

@@ -1844,9 +1849,10 @@ def __init__(self, d, b, l, t, r_out, n_r, shift=[0, 0]):
18441849
# construct the outer bottom right radius
18451850
self.draw_radius([b - r_out, r_out], r_out, 1.5 * np.pi, n_r)
18461851

1847-
# add next two points
1848-
self.points.append([b, l])
1849-
self.points.append([b - t, l])
1852+
if r_out != l:
1853+
# add next two points
1854+
self.points.append([b, l])
1855+
self.points.append([b - t, l])
18501856

18511857
# construct the inner bottom right radius
18521858
self.draw_radius([b - t - r_in, t + r_in], r_in, 0, n_r, False)
@@ -1861,9 +1867,10 @@ def __init__(self, d, b, l, t, r_out, n_r, shift=[0, 0]):
18611867
self.draw_radius(
18621868
[b - t - r_in, d - t - r_in], r_in, 0.5 * np.pi, n_r, False)
18631869

1864-
# add next two points
1865-
self.points.append([b - t, d - l])
1866-
self.points.append([b, d - l])
1870+
if r_out != l:
1871+
# add next two points
1872+
self.points.append([b - t, d - l])
1873+
self.points.append([b, d - l])
18671874

18681875
# construct the outer top right radius
18691876
self.draw_radius([b - r_out, d - r_out], r_out, 0, n_r)
@@ -1899,6 +1906,7 @@ class ZedSection(Geometry):
18991906
:param int n_r: Number of points discretising the outer radius
19001907
:param shift: Vector that shifts the cross-section by *(x, y)*
19011908
:type shift: list[float, float]
1909+
:raises Exception: Lip length must be greater than the outer radius
19021910
19031911
The following example creates a Zed section with a depth of 100, a left
19041912
flange width of 40, a right flange width of 50, a lip of 20, a thickness of
@@ -1924,6 +1932,10 @@ class ZedSection(Geometry):
19241932
def __init__(self, d, b_l, b_r, l, t, r_out, n_r, shift=[0, 0]):
19251933
"""Inits the ZedSection class."""
19261934

1935+
# ensure the lip length is greater than the outer radius
1936+
if l < r_out:
1937+
raise Exception('Lip length must be greater than the outer radius')
1938+
19271939
# assign control point
19281940
control_points = [[t * 0.5, d * 0.5]]
19291941

@@ -1938,9 +1950,10 @@ def __init__(self, d, b_l, b_r, l, t, r_out, n_r, shift=[0, 0]):
19381950
# construct the outer bottom right radius
19391951
self.draw_radius([b_r - r_out, r_out], r_out, 1.5 * np.pi, n_r)
19401952

1941-
# add next two points
1942-
self.points.append([b_r, l])
1943-
self.points.append([b_r - t, l])
1953+
if r_out != l:
1954+
# add next two points
1955+
self.points.append([b_r, l])
1956+
self.points.append([b_r - t, l])
19441957

19451958
# construct the inner bottom right radius
19461959
self.draw_radius([b_r - t - r_in, t + r_in], r_in, 0, n_r, False)
@@ -1954,9 +1967,10 @@ def __init__(self, d, b_l, b_r, l, t, r_out, n_r, shift=[0, 0]):
19541967
# construct the outer top left radius
19551968
self.draw_radius([t - b_l + r_out, d - r_out], r_out, 0.5 * np.pi, n_r)
19561969

1957-
# add the next two points
1958-
self.points.append([t - b_l, d - l])
1959-
self.points.append([t - b_l + t, d - l])
1970+
if r_out != l:
1971+
# add the next two points
1972+
self.points.append([t - b_l, d - l])
1973+
self.points.append([t - b_l + t, d - l])
19601974

19611975
# construct the inner top left radius
19621976
self.draw_radius(

0 commit comments

Comments
 (0)