From a3d6692e538a1dbf77b17bf72226a4f7ce09ef7d Mon Sep 17 00:00:00 2001 From: Brooks Smith Date: Tue, 3 Oct 2023 11:54:36 +1100 Subject: [PATCH 1/4] Allow unlipped cee and zed steel_sections --- .../pre/library/steel_sections.py | 146 +++++++++++++----- 1 file changed, 110 insertions(+), 36 deletions(-) diff --git a/src/sectionproperties/pre/library/steel_sections.py b/src/sectionproperties/pre/library/steel_sections.py index 64084a85..09450254 100644 --- a/src/sectionproperties/pre/library/steel_sections.py +++ b/src/sectionproperties/pre/library/steel_sections.py @@ -1051,7 +1051,7 @@ def cee_section( Args: d: Depth of the cee section b: Width of the cee section - l: Lip of the cee section + l: Lip of the cee section (which can be zero) t: Thickness of the cee section r_out: Outer radius of the cee section n_r: Number of points discretising the outer radius @@ -1088,20 +1088,39 @@ def cee_section( # construct the outer bottom left radius points += sp_utils.draw_radius(pt=(r_out, r_out), r=r_out, theta=np.pi, n=n_r) - # construct the outer bottom right radius - points += sp_utils.draw_radius( - pt=(b - r_out, r_out), r=r_out, theta=1.5 * np.pi, n=n_r - ) + # if the lip is longer than the outer radius (curve + straight section + if l > r_out: + # construct the outer bottom right radius + points += sp_utils.draw_radius( + pt=(b - r_out, r_out), r=r_out, theta=1.5 * np.pi, n=n_r + ) - if r_out != l: # add next two points points.append((b, l)) points.append((b - t, l)) - # construct the inner bottom right radius - points += sp_utils.draw_radius( - pt=(b - t - r_in, t + r_in), r=r_in, theta=0, n=n_r, ccw=False - ) + # construct the inner bottom right radius + points += sp_utils.draw_radius( + pt=(b - t - r_in, t + r_in), r=r_in, theta=0, n=n_r, ccw=False + ) + + # if the lip is shorter than the outer radius (curve only) + elif t < l and l <= r_out: + # construct a smaller corner for bottom right if t < l < r_out + r_out_l = l + r_in_l = max(l - t, 0) + points += sp_utils.draw_radius( + pt=(b - r_out_l, r_out_l), r=r_out_l, theta=1.5 * np.pi, n=n_r) + ) + points += sp_utils.draw_radius( + pt=(b - t - r_in_l, t + r_in_l), r=r_in_l, theta=0, n=n_r, ccw=False + ) + + # if the lip length is less than the section thickness (no lip) + elif l <= t: + # construct end as two points only + points.append((b, 0)) + points.append((b, t)) # construct the inner bottom left radius points += sp_utils.draw_radius( @@ -1113,18 +1132,37 @@ def cee_section( pt=(t + r_in, d - t - r_in), r=r_in, theta=np.pi, n=n_r, ccw=False ) - # construct the inner top right radius - points += sp_utils.draw_radius( - pt=(b - t - r_in, d - t - r_in), r=r_in, theta=0.5 * np.pi, n=n_r, ccw=False - ) + # if the lip is longer than the outer radius (curve + straight section) + if l > r_out: + # construct the inner top right radius + points += sp_utils.draw_radius( + pt=(b - t - r_in, d - t - r_in), r=r_in, theta=0.5 * np.pi, n=n_r, ccw=False + ) - if r_out != l: # add next two points points.append((b - t, d - l)) points.append((b, d - l)) - # construct the outer top right radius - points += sp_utils.draw_radius(pt=(b - r_out, d - r_out), r=r_out, theta=0, n=n_r) + # construct the outer top right radius + points += sp_utils.draw_radius( + pt=(b - r_out, d - r_out), r=r_out, theta=0, n=n_r + ) + + # if the lip is shorter than the outer radius (curve only) + elif l > t and l <= r_out: + # construct a smaller corner for top right if t < l < r_out + points += sp_utils.draw_radius( + pt=(b - t - r_in_l, d - t - r_in_l), r=r_in_l, theta=0.5 * np.pi, n=n_r, ccw=False + ) + points += sp_utils.draw_radius( + pt=(b - r_out_l, d - r_out_l), r=r_out_l, theta=0, n=n_r + ) + + # if the lip length is less than the section thickness (no lip) + elif l <= t: + # construct end as two points only + points.append((b, d - t)) + points.append((b, d)) # construct the outer top left radius points += sp_utils.draw_radius( @@ -1158,7 +1196,7 @@ def zed_section( d: Depth of the zed section b_l: Left flange width of the zed section b_r: Right flange width of the zed section - l: Lip of the zed section + l: Lip of the zed section (which can be zero) t: Thickness of the zed section r_out: Outer radius of the zed section n_r: Number of points discretising the outer radius @@ -1198,20 +1236,39 @@ def zed_section( # construct the outer bottom left radius points += sp_utils.draw_radius(pt=(r_out, r_out), r=r_out, theta=np.pi, n=n_r) - # construct the outer bottom right radius - points += sp_utils.draw_radius( - pt=(b_r - r_out, r_out), r=r_out, theta=1.5 * np.pi, n=n_r - ) + # if the lip is longer than the outer radius (curve + straight section + if l > r_out: + # construct the outer bottom right radius + points += sp_utils.draw_radius( + pt=(b_r - r_out, r_out), r=r_out, theta=1.5 * np.pi, n=n_r + ) - if r_out != l: # add next two points points.append((b_r, l)) points.append((b_r - t, l)) - # construct the inner bottom right radius - points += sp_utils.draw_radius( - pt=(b_r - t - r_in, t + r_in), r=r_in, theta=0, n=n_r, ccw=False - ) + # construct the inner bottom right radius + points += sp_utils.draw_radius( + pt=(b_r - t - r_in, t + r_in), r=r_in, theta=0, n=n_r, ccw=False + ) + + # if the lip is shorter than the outer radius (curve only) + elif l > t and l <= r_out: + # construct a smaller corner for bottom right if t < l < r_out + r_out_l = l + r_in_l = max(l - t, 0) + points += sp_utils.draw_radius( + pt=(b_r - r_out_l, r_out_l), r=r_out_l, theta=1.5 * np.pi, n=n_r) + ) + points += sp_utils.draw_radius( + pt=(b_r - t - r_in_l, t + r_in_l), r=r_in_l, theta=0, n=n_r, ccw=False + ) + + # if the lip length is less than the section thickness (no lip) + elif l <= t: + # construct end as two points only + points.append((b_r, 0)) + points.append((b_r, t)) # construct the inner bottom left radius points += sp_utils.draw_radius( @@ -1221,20 +1278,37 @@ def zed_section( # construct the outer top right radius points += sp_utils.draw_radius(pt=(t - r_out, d - r_out), r=r_out, theta=0, n=n_r) - # construct the outer top left radius - points += sp_utils.draw_radius( - pt=(t - b_l + r_out, d - r_out), r=r_out, theta=0.5 * np.pi, n=n_r - ) + # if the lip is longer than the outer radius (curve + straight section + if l > r_out: + # construct the outer top left radius + points += sp_utils.draw_radius( + pt=(t - b_l + r_out, d - r_out), r=r_out, theta=0.5 * np.pi, n=n_r + ) - if r_out != l: # add the next two points points.append((t - b_l, d - l)) points.append((t - b_l + t, d - l)) - # construct the inner top left radius - points += sp_utils.draw_radius( - pt=(2 * t - b_l + r_in, d - t - r_in), r=r_in, theta=np.pi, n=n_r, ccw=False - ) + # construct the inner top left radius + points += sp_utils.draw_radius( + pt=(2 * t - b_l + r_in, d - t - r_in), r=r_in, theta=np.pi, n=n_r, ccw=False + ) + + # if the lip is shorter than the outer radius (curve only) + elif t < l and l <= r_out: + # construct a smaller corner for top left if t < l < r_out + points += sp_utils.draw_radius( + pt=(t - b_l + r_out_l, d - r_out_l), r=r_out_l, theta=0.5 * np.pi, n=n_r + ) + points += sp_utils.draw_radius( + pt=(2 * t - b_l + r_in_l, d - t - r_in_l), r=r_in_l, theta=np.pi, n=n_r, ccw=False + ) + + # if the lip length is less than the section thickness (no lip) + elif l <= t: + # construct end as two points only + points.append((t - b_l, d)) + points.append((t - b_l, d - t)) # construct the inner top right radius points += sp_utils.draw_radius( From 0e8cc8710afc276975588ab2150c9cb0bcac91cf Mon Sep 17 00:00:00 2001 From: robbievanleeuwen Date: Tue, 3 Oct 2023 13:34:02 +1100 Subject: [PATCH 2/4] Remove extra parenthesis; consistent if statements --- src/sectionproperties/pre/library/steel_sections.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sectionproperties/pre/library/steel_sections.py b/src/sectionproperties/pre/library/steel_sections.py index 09450254..85f5943c 100644 --- a/src/sectionproperties/pre/library/steel_sections.py +++ b/src/sectionproperties/pre/library/steel_sections.py @@ -1105,12 +1105,12 @@ def cee_section( ) # if the lip is shorter than the outer radius (curve only) - elif t < l and l <= r_out: + elif l > t and l <= r_out: # construct a smaller corner for bottom right if t < l < r_out r_out_l = l r_in_l = max(l - t, 0) points += sp_utils.draw_radius( - pt=(b - r_out_l, r_out_l), r=r_out_l, theta=1.5 * np.pi, n=n_r) + pt=(b - r_out_l, r_out_l), r=r_out_l, theta=1.5 * np.pi, n=n_r ) points += sp_utils.draw_radius( pt=(b - t - r_in_l, t + r_in_l), r=r_in_l, theta=0, n=n_r, ccw=False @@ -1258,12 +1258,12 @@ def zed_section( r_out_l = l r_in_l = max(l - t, 0) points += sp_utils.draw_radius( - pt=(b_r - r_out_l, r_out_l), r=r_out_l, theta=1.5 * np.pi, n=n_r) + pt=(b_r - r_out_l, r_out_l), r=r_out_l, theta=1.5 * np.pi, n=n_r ) points += sp_utils.draw_radius( pt=(b_r - t - r_in_l, t + r_in_l), r=r_in_l, theta=0, n=n_r, ccw=False ) - + # if the lip length is less than the section thickness (no lip) elif l <= t: # construct end as two points only @@ -1295,7 +1295,7 @@ def zed_section( ) # if the lip is shorter than the outer radius (curve only) - elif t < l and l <= r_out: + elif l > t and l <= r_out: # construct a smaller corner for top left if t < l < r_out points += sp_utils.draw_radius( pt=(t - b_l + r_out_l, d - r_out_l), r=r_out_l, theta=0.5 * np.pi, n=n_r From 81d12769686308f88063c7600899130ac08ad02b Mon Sep 17 00:00:00 2001 From: robbievanleeuwen Date: Tue, 3 Oct 2023 13:37:03 +1100 Subject: [PATCH 3/4] Blackify --- .../pre/library/steel_sections.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/sectionproperties/pre/library/steel_sections.py b/src/sectionproperties/pre/library/steel_sections.py index 85f5943c..4e30543f 100644 --- a/src/sectionproperties/pre/library/steel_sections.py +++ b/src/sectionproperties/pre/library/steel_sections.py @@ -1103,7 +1103,7 @@ def cee_section( points += sp_utils.draw_radius( pt=(b - t - r_in, t + r_in), r=r_in, theta=0, n=n_r, ccw=False ) - + # if the lip is shorter than the outer radius (curve only) elif l > t and l <= r_out: # construct a smaller corner for bottom right if t < l < r_out @@ -1152,7 +1152,11 @@ def cee_section( elif l > t and l <= r_out: # construct a smaller corner for top right if t < l < r_out points += sp_utils.draw_radius( - pt=(b - t - r_in_l, d - t - r_in_l), r=r_in_l, theta=0.5 * np.pi, n=n_r, ccw=False + pt=(b - t - r_in_l, d - t - r_in_l), + r=r_in_l, + theta=0.5 * np.pi, + n=n_r, + ccw=False, ) points += sp_utils.draw_radius( pt=(b - r_out_l, d - r_out_l), r=r_out_l, theta=0, n=n_r @@ -1301,7 +1305,11 @@ def zed_section( pt=(t - b_l + r_out_l, d - r_out_l), r=r_out_l, theta=0.5 * np.pi, n=n_r ) points += sp_utils.draw_radius( - pt=(2 * t - b_l + r_in_l, d - t - r_in_l), r=r_in_l, theta=np.pi, n=n_r, ccw=False + pt=(2 * t - b_l + r_in_l, d - t - r_in_l), + r=r_in_l, + theta=np.pi, + n=n_r, + ccw=False, ) # if the lip length is less than the section thickness (no lip) From 2bd283fff7bb0a1de323566a2c51b4e7ade76424 Mon Sep 17 00:00:00 2001 From: robbievanleeuwen Date: Tue, 3 Oct 2023 13:56:53 +1100 Subject: [PATCH 4/4] Remove restriction on lip length --- .../pre/library/steel_sections.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/sectionproperties/pre/library/steel_sections.py b/src/sectionproperties/pre/library/steel_sections.py index 4e30543f..03bf0365 100644 --- a/src/sectionproperties/pre/library/steel_sections.py +++ b/src/sectionproperties/pre/library/steel_sections.py @@ -1060,9 +1060,6 @@ def cee_section( Returns: Cee section geometry - Raises: - ValueError: Lip length must be greater than the outer radius - Example: The following example creates a cee section with a depth of 125 mm, a width of 30 mm, a lip of 30 mm, a thickness of 1.5 mm and an outer radius of 6 mm, using @@ -1076,10 +1073,6 @@ def cee_section( cee_section(d=125, b=50, l=30, t=1.5, r_out=6, n_r=8).plot_geometry() """ - # ensure the lip length is greater than the outer radius - if l < r_out: - raise ValueError("Lip length must be greater than the outer radius") - points: list[tuple[float, float]] = [] # calculate internal radius @@ -1209,9 +1202,6 @@ def zed_section( Returns: Zed section geometry - Raises: - ValueError: Lip length must be greater than the outer radius - Example: The following example creates a zed section with a depth of 100 mm, a left flange width of 40 mm, a right flange width of 50 mm, a lip of 20 mm, a @@ -1228,10 +1218,6 @@ def zed_section( d=100, b_l=40, b_r=50, l=20, t=1.2, r_out=5, n_r=8 ).plot_geometry() """ - # ensure the lip length is greater than the outer radius - if l < r_out: - raise ValueError("Lip length must be greater than the outer radius") - points: list[tuple[float, float]] = [] # calculate internal radius