Geometries

General

Geometry objects are responsible for storing a polygon, a point, or a compound of two or more of the former, and their respective material objects. Geometry objects are therefore the physical representation of a section.

Surface geometries

A SurfaceGeometry is initialized by passing a shapely.Polygon with an arbitrary shape, and a material object. See the example below where we create a T-shaped geometry.

Note that adding two or more SurfaceGeometry objects results in a CompoundGeometry object.

Syntax
Create surface geometries.
from shapely import Polygon

from structuralcodes.geometry import SurfaceGeometry
from structuralcodes.materials.concrete import ConcreteEC2_2004

# Define parameters
fck = 45
width_web = 250
width_flange = 1000
height_web = 650
height_flange = 150

# Create material
concrete = ConcreteEC2_2004(fck=fck)

# Create polygons
polygon_web = Polygon(
    (
        (-width_web / 2, 0),
        (width_web / 2, 0),
        (width_web / 2, height_web),
        (-width_web / 2, height_web),
    )
)
polygon_flange = Polygon(
    (
        (-width_flange / 2, height_web),
        (width_flange / 2, height_web),
        (width_flange / 2, height_web + height_flange),
        (-width_flange / 2, height_web + height_flange),
    ),
)

# Create a T-shaped polygon by taking the union of the two rectangles
polygon_t = polygon_web.union(polygon_flange)

# Create surface geometry
t_geom = SurfaceGeometry(poly=polygon_t, material=concrete)

The final geometry is shown in the figure below.

../../_images/t_shaped_geometry.svg

The t-shaped geometry created with the code above.

Tip

If you work in a Jupyter notebook, and return the geometry object in the final line of a code cell, the shape is visualized in the output below the code cell ✨

Tip

In the code above we used Shapely to model the shape of the geometry. We created the t-shaped geometry by taking the union of two polygons, but we could just as well have created one t-shaped polygon directly. You can read more about geometry creation with Shapely here.

If the t-shaped geometry was made with two different materials, say one material for the flange and one for the web, we could have created two geometry objects, e.g. one SurfaceGeometry for the flange and one SurfaceGeometry for the web, and added these together (+) to create a CompoundGeometry.

Creating holes

If you ever need to create a hole in a geometry, simply create a separate geometry object for the hole, and subtract it from the other. This operation returns a new CompoundGeometry with a hole ✅

If you prefer to do the modelling with Shapely, this is also possible. Simply subtract the polygon of the hole from the polygon of the base geometry, and use the result as input to a SurfaceGeometry.

Rectangular and circular geometries

To simplify creating common geometrical shapes, we can use the RectangularGeometry or CircularGeometry classes. These classes are wrappers for creating surface geometries with either a rectangular or a circular shape.

Using RectangularGeometry, the above example can be simplified to the example below, where the changed lines are highlighted.

Syntax
Create surface geometries using wrapper class for rectangular shape.
from structuralcodes.geometry import RectangularGeometry
from structuralcodes.materials.concrete import ConcreteEC2_2004

# Define parameters
fck = 45
width_web = 250
width_flange = 1000
height_web = 650
height_flange = 150

# Create material
concrete = ConcreteEC2_2004(fck=fck)

# Create surface geometries
web_geom = RectangularGeometry(
    width=width_web,
    height=height_web,
    material=concrete,
    origin=(0, height_web / 2),
)
flange_geom = RectangularGeometry(
    width=width_flange,
    height=height_flange,
    material=concrete,
    origin=(0, height_web + height_flange / 2),
)

# Add surface geometries to create a T-shaped geometry
t_geom = web_geom + flange_geom

Point geometries and ways to add reinforcement

A PointGeometry is a geometrical object defined by a coordinate, a diameter, and a material. Point geometries are used to represent reinforcement, and can be included in arbitrary locations, and in arbitrary numbers.

There are several ways to create point geometries and add these to other geometry objects as reinforcement. Each of the following options results in a CompoundGeometry object holding the geometry object(s) that are reinforced, and the point geometries that act as reinforcement.

The example below demonstrates how to add two layers of longitudinal reinforcement to the T-shaped geometry created above. The changed lines are highlighted.

Notice how add_reinforcement_line() returns a new CompoundGeometry representing the T-shaped surface geometry and the point geometries for the longitudinal reinforcement. The final geometry with reinforcement is shown in the figure below.

Syntax
Create surface geometries with reinforcement.
from structuralcodes.codes.ec2_2004 import reinforcement_duct_props
from structuralcodes.geometry import (
    RectangularGeometry,
    add_reinforcement_line,
)
from structuralcodes.materials.concrete import ConcreteEC2_2004
from structuralcodes.materials.reinforcement import ReinforcementEC2_2004

# Define parameters
fck = 30
fyk = 500
Es = 200000
ductility_class = 'C'
width_web = 250
width_flange = 1000
height_web = 650
height_flange = 150
diameter_bar = 20
cover = 50
n_bars_layer = 3

# Create material
concrete = ConcreteEC2_2004(fck=fck)
reinforcement = ReinforcementEC2_2004(
    fyk=fyk,
    Es=Es,
    **reinforcement_duct_props(fyk=fyk, ductility_class=ductility_class),
)

# Create surface geometries
web_geom = RectangularGeometry(
    width=width_web,
    height=height_web,
    material=concrete,
    origin=(0, height_web / 2),
)
flange_geom = RectangularGeometry(
    width=width_flange,
    height=height_flange,
    material=concrete,
    origin=(0, height_web + height_flange / 2),
)

# Add surface geometries to create a T-shaped geometry
t_geom = web_geom + flange_geom

# Add two layers of reinforcement
for y_coord in (
    cover + diameter_bar / 2,
    2 * cover + 3 * diameter_bar / 2,
):
    t_geom = add_reinforcement_line(
        geo=t_geom,
        coords_i=(
            -width_web / 2 + cover + diameter_bar / 2,
            y_coord,
        ),
        coords_j=(
            width_web / 2 - cover - diameter_bar / 2,
            y_coord,
        ),
        diameter=diameter_bar,
        material=reinforcement,
        n=n_bars_layer,
    )
../../_images/t_shaped_geometry_with_reinforcement.svg

The t-shaped geometry with reinforcement created with the code above.

Profiles

StructuralCodes comes with a set of predefined common profiles. A profile class is a wrapper around a shapely.Polygon and exposes the most common elastic and plastic section properties.

The following families of profiles are available:

The available profiles within each family can be listed by calling the .profiles method on the respective class. The code below shows how to list the available profiles in the HE family.

Syntax
List the available profiles in the HE family.
from structuralcodes.geometry.profiles import HE

HE.profiles()

To create an HEA100 profile, simply pass the name of the profile to the class as shown below.

Syntax
List the available profiles in the HE family.
from structuralcodes.geometry.profiles import HE

hea100 = HE('HEA100')

The figure below shows the shape of the profile.

../../_images/hea100.svg

The shape of the profile created with the code above.

Notice how all the predefined profiles expose thicknesses, widths, heights, radii, etc. as properties along with elastic and plastic section properties like Iy, Wely, Wply, and iy.

Tip

The profiles expose the underlying shapely.Polygon as the .polygon property. This can be passed to a SurfaceGeometry along with a material for use in further calculations. See for example the following code where calculate the bending strength of an IPE100 profile.

Syntax
Use a profile in a geometry and calculate the bending strength.
from structuralcodes.geometry import SurfaceGeometry
from structuralcodes.geometry.profiles import IPE
from structuralcodes.materials.basic import ElasticPlasticMaterial
from structuralcodes.sections import GenericSection

# Create a profile
ipe100 = IPE('IPE100')

# Create an elastic perfect plastic material
steel = ElasticPlasticMaterial(E=210000, fy=275 / 1.05, density=7850)

# Create a geometry and a section
geom = SurfaceGeometry(poly=ipe100.polygon, material=steel)
section = GenericSection(geometry=geom)

# Use the section calculator to calculate the bending strength
bending_strength = section.section_calculator.calculate_bending_strength()