Skip to content

Commit 7cd1fea

Browse files
committed
Added add_bar() to sectionproperties concrete module, updated doc string for concrete_column_section(), incomplete
1 parent fd62fad commit 7cd1fea

File tree

1 file changed

+49
-22
lines changed

1 file changed

+49
-22
lines changed

sectionproperties/pre/library/concrete_sections.py

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import Union
12
import numpy as np
23
from shapely.geometry import Polygon
34
import sectionproperties.pre.pre as pre
@@ -132,7 +133,7 @@ def concrete_rectangular_section(
132133
def concrete_column_section(
133134
b: float,
134135
d: float,
135-
bar_diam: float,
136+
dia_bar: float,
136137
bar_area: float,
137138
cover: float,
138139
n_bars_b: int,
@@ -147,27 +148,27 @@ def concrete_column_section(
147148
with *n_circle* points with equal side and top/bottom
148149
*cover* to the steel.
149150
150-
:param float b: Concrete section width
151-
:param float d: Concrete section depth
152-
:param float dia_top: Diameter of the top steel reinforcing bars
153-
:param int n_top: Number of top steel reinforcing bars
154-
:param float dia_bot: Diameter of the bottom steel reinforcing bars
155-
:param int n_bot: Number of bottom steel reinforcing bars
156-
:param int n_circle: Number of points discretising the steel reinforcing bars
157-
:param float cover: Side and bottom cover to the steel reinforcing bars
158-
:param float area_top: If provided, constructs top reinforcing bars based on their
159-
area rather than diameter (prevents the underestimation of steel area due to
160-
circle discretisation)
161-
:param float area_bot: If provided, constructs bottom reinforcing bars based on
162-
their area rather than diameter (prevents the underestimation of steel area due
163-
to circle discretisation)
151+
:param float b: Concrete section width, parallel to the x-axis
152+
:param float d: Concrete section depth, parallel to the y-axis
153+
:param float dia_bar: Diameter of reinforcing bars. Used only for calculating bar location.
154+
:param float bar_area: Area of reinforcing bars. Used for section capacity calculations.
155+
:param float cover: Clear cover, calculated as distance from edge of reinforcing bar to edge of section.
156+
:param int n_bars_b: Number of bars placed across the width of the section, minimum 2.
157+
:param int n_bars_d: Number of bars placed across the depth of the section, minimum 2.
164158
:param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to
165159
associate with the concrete
166160
:param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to
167-
associate with the steel
168-
169-
:raises ValueErorr: If the number of bars is not greater than or equal to 2 in an
170-
active layer
161+
associate with the reinforcing steel
162+
:param bool filled: When True, will populate the concrete section with an equally
163+
spaced 2D array of reinforcing bars numbering 'n_bars_b' by 'n_bars_d'.
164+
When False, only the bars around the perimeter of the array will be present.
165+
:param int n_circle: The number of points used to discretize the circle of the reinforcing
166+
bars. The bars themselves will have an exact area of 'bar_area' regardless of the
167+
number of points used in the circle. Useful for making the reinforcing bars look
168+
more circular when plotting the concrete section.
169+
170+
:raises ValueErorr: If the number of bars in either 'n_bars_b' or 'n_bars_d' is not greater
171+
than or equal to 2.
171172
172173
The following example creates a 600D x 300W concrete beam with 3N20 bottom steel
173174
reinforcing bars and 30 mm cover::
@@ -184,8 +185,8 @@ def concrete_column_section(
184185
density=7.85e-6, color='grey'
185186
)
186187
187-
geometry = concrete_rectangular_section(
188-
b=300, d=600, dia_top=20, n_top=0, dia_bot=20, n_bot=3, n_circle=24, cover=30,
188+
geometry = concrete_column_section(
189+
b=300, d=600, bar_diam=dia_top=20, n_top=0, dia_bot=20, n_bot=3, n_circle=24, cover=30,
189190
conc_mat=concrete, steel_mat=steel
190191
)
191192
geometry.create_mesh(mesh_sizes=[500])
@@ -203,7 +204,7 @@ def concrete_column_section(
203204
Mesh generated from the above geometry.
204205
"""
205206
concrete_geometry = primitive_sections.rectangular_section(b, d, material=conc_mat)
206-
bar_extents = concrete_geometry.offset_perimeter(-cover - bar_diam/2).calculate_extents()
207+
bar_extents = concrete_geometry.offset_perimeter(-cover - dia_bar/2).calculate_extents()
207208
bar_x_min, bar_x_max, bar_y_min, bar_y_max = bar_extents
208209

209210
b_edge_bars_x = np.linspace(bar_x_min, bar_x_max, n_bars_b)
@@ -467,3 +468,29 @@ def concrete_circular_section(
467468
geom = (geom - bar) + bar
468469

469470
return geom
471+
472+
473+
def add_bar(
474+
geometry: Union[geometry.Geometry, geometry.CompoundGeometry],
475+
area: float,
476+
material: pre.DEFAULT_MATERIAL,
477+
x: float,
478+
y: float,
479+
n: int = 4,
480+
) -> geometry.CompoundGeometry:
481+
"""Adds a reinforcing bar to a *sectionproperties* geometry.
482+
Bars are discretised by four points by default.
483+
:param geometry: Reinforced concrete geometry to which the new bar will be added
484+
:param area: Bar cross-sectional area
485+
:param material: Material object for the bar
486+
:param x: x-position of the bar
487+
:param y: y-position of the bar
488+
:param n: Number of points to discretise the bar circle
489+
:return: Reinforced concrete geometry with added bar
490+
"""
491+
492+
bar = primitive_sections.circular_section_by_area(
493+
area=area, n=n, material=material # type: ignore
494+
).shift_section(x_offset=x, y_offset=y)
495+
496+
return (geometry - bar) + bar

0 commit comments

Comments
 (0)