import sectionproperties.pre.sections as sections
from sectionproperties.analysis.cross_section import CrossSection
mesh_area = 25 # max mesh size
d = 612 # I section depth
b_f = 229 # I-section flange width
t_f = 19.6 # I-section flange thickness
t_w = 11.9 # I-section web thickness
r_1 = 14 # I-section root radii
n_r = 50 # number of points considered around root radii
d_p = 650 # strengthening plate depth
b_p = 12 # strengthening plate thickness
# create constituent geometry
geometry1 = sections.ISection(d=d, b=b_f, t_f=t_f, t_w=t_w, r=r_1, n_r=n_r, shift=[-b_f / 2, -d / 2])
geometry2 = sections.RectangularSection(d=d_p, b=b_p, shift=[-b_f / 2 - b_p, -d_p / 2])
geometry3 = sections.RectangularSection(d=d_p, b=b_p, shift=[b_f / 2, -d_p / 2])
# create merged section
geometry = sections.MergedSection([geometry1, geometry2, geometry3])
# add holes
geometry.add_hole([-b_f / 3, 0])
geometry.add_hole([b_f / 3, 0])
# create mesh
mesh = geometry.create_mesh(mesh_sizes=[mesh_area, mesh_area, mesh_area])
# clean geometry
geometry.clean_geometry(verbose=True)
# create section
section = CrossSection(geometry, mesh)
# calculate results
section.calculate_geometric_properties()
section.calculate_plastic_properties()
section.calculate_warping_properties()
# plot results
section.plot_mesh()
section.plot_centroids()
# display all results
# check [URL unfurl="true"]https://sectionproperties.readthedocs.io/en/latest/rst/post.html[/URL] for definitions
section.display_results(fmt='.3f')
# this will specifically display torsion and warping constants
J = section.get_j()
I_w = section.get_gamma()
print(f'J = {J}')
print(f'I_w = {I_w}')