Exemple #1
0
def rectangular_hollow_section(
    b: float,
    d: float,
    t: float,
    r_out: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs a rectangular hollow section (RHS) centered at *(b/2, d/2)*, with depth *d*, width *b*,
    thickness *t* and outer radius *r_out*, using *n_r* points to construct the inner and outer
    radii. If the outer radius is less than the thickness of the RHS, the inner radius is set to
    zero.

    :param float d: Depth of the RHS
    :param float b: Width of the RHS
    :param float t: Thickness of the RHS
    :param float r_out: Outer radius of the RHS
    :param int n_r: Number of points discretising the inner and outer radii
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates an RHS with a depth of 100, a width of 50, a thickness of 6 and
    an outer radius of 9, using 8 points to discretise the inner and outer radii. A mesh is
    generated with a maximum triangular area of 2.0::

        from sectionproperties.pre.library.steel_sections import rectangular_hollow_section

        geometry = rectangular_hollow_section(d=100, b=50, t=6, r_out=9, n_r=8)
        geometry.create_mesh(mesh_sizes=[2.0])

    ..  figure:: ../images/sections/rhs_geometry.png
        :align: center
        :scale: 75 %

        RHS geometry.

    ..  figure:: ../images/sections/rhs_mesh.png
        :align: center
        :scale: 75 %

        Mesh generated from the above geometry.
    """
    points_inner = []
    points_outer = []
    # calculate internal radius
    r_in = max(r_out - t, 0)
    # construct the outer radius points
    points_outer += draw_radius([r_out, r_out], r_out, np.pi, n_r)
    points_outer += draw_radius([b - r_out, r_out], r_out, 1.5 * np.pi, n_r)
    points_outer += draw_radius([b - r_out, d - r_out], r_out, 0, n_r)
    points_outer += draw_radius([r_out, d - r_out], r_out, 0.5 * np.pi, n_r)

    points_inner += draw_radius([t + r_in, t + r_in], r_in, np.pi, n_r)
    points_inner += draw_radius([b - t - r_in, t + r_in], r_in, 1.5 * np.pi, n_r)
    points_inner += draw_radius([b - t - r_in, d - t - r_in], r_in, 0, n_r)
    points_inner += draw_radius([t + r_in, d - t - r_in], r_in, 0.5 * np.pi, n_r)

    outer = Polygon(points_outer)
    inner = Polygon(points_inner)
    return geometry.Geometry(outer - inner, material)
Exemple #2
0
def triangular_radius_section(
    b: float, n_r: float, material: pre.Material = pre.DEFAULT_MATERIAL
) -> geometry.Geometry:
    """Constructs a right angled isosceles triangle with points *(0, 0)*, *(b, 0)*, *(0, h)* and a
    concave radius on the hypotenuse.

    :param float b: Base length of triangle
    :param int n_r: Number of points discretising the radius
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates a triangular radius cross-section with a base width of 6, using
    *n_r* points to construct the radius, and generates a mesh with a maximum triangular area of
    0.5::

        from sectionproperties.pre.library.primitive_sections import triangular_radius_section

        geometry = triangular_radius_section(b=6, n_r=16)
        geometry.create_mesh(mesh_sizes=[0.5])

    ..  figure:: ../images/sections/triangle_radius_geometry.png
        :align: center
        :scale: 40 %

        Triangular radius section geometry.

    ..  figure:: ../images/sections/triangle_radius_mesh.png
        :align: center
        :scale: 40 %

        Mesh generated from the above geometry.
    """
    points = [(0, 0)]
    points += draw_radius(pt=[b, b], r=b, theta=3 * np.pi / 2, n=n_r, ccw=False)
    triangle = Polygon(points)
    return geometry.Geometry(triangle, material)
Exemple #3
0
def cruciform_section(
    d: float,
    b: float,
    t: float,
    r: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs a cruciform section centered at the origin *(0, 0)*, with depth *d*, width *b*,
    thickness *t* and root radius *r*, using *n_r* points to construct the root radius.

    :param float d: Depth of the cruciform section
    :param float b: Width of the cruciform section
    :param float t: Thickness of the cruciform section
    :param float r: Root radius of the cruciform section
    :param int n_r: Number of points discretising the root radius
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates a cruciform section with a depth of 250, a width of 175, a
    thickness of 12 and a root radius of 16, using 16 points to discretise the radius. A mesh is
    generated with a maximum triangular area of 5.0::

        from sectionproperties.pre.library.primitive_sections import cruciform_section

        geometry = cruciform_section(d=250, b=175, t=12, r=16, n_r=16)
        geometry.create_mesh(mesh_sizes=[5.0])

    ..  figure:: ../images/sections/cruciform_geometry.png
        :align: center
        :scale: 75 %

        Cruciform section geometry.

    ..  figure:: ../images/sections/cruciform_mesh.png
        :align: center
        :scale: 75 %
    """
    points = []

    # add first two points
    points.append([-t * 0.5, -d * 0.5])
    points.append([t * 0.5, -d * 0.5])

    # construct the bottom right radius
    pt = [0.5 * t + r, -0.5 * t - r]
    points += draw_radius(pt, r, np.pi, n_r, False)

    # add the next two points
    points.append([0.5 * b, -t * 0.5])
    points.append([0.5 * b, t * 0.5])

    # construct the top right radius
    pt = [0.5 * t + r, 0.5 * t + r]
    points += draw_radius(pt, r, 1.5 * np.pi, n_r, False)

    # add the next two points
    points.append([t * 0.5, 0.5 * d])
    points.append([-t * 0.5, 0.5 * d])

    # construct the top left radius
    pt = [-0.5 * t - r, 0.5 * t + r]
    points += draw_radius(pt, r, 0, n_r, False)

    # add the next two points
    points.append([-0.5 * b, t * 0.5])
    points.append([-0.5 * b, -t * 0.5])

    # construct the bottom left radius
    pt = [-0.5 * t - r, -0.5 * t - r]
    points += draw_radius(pt, r, 0.5 * np.pi, n_r, False)

    polygon = Polygon(points)
    return geometry.Geometry(polygon, material)
Exemple #4
0
def angle_section(
    d: float,
    b: float,
    t: float,
    r_r: float,
    r_t: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs an angle section with the bottom left corner at the origin *(0, 0)*, with depth
    *d*, width *b*, thickness *t*, root radius *r_r* and toe radius *r_t*, using *n_r* points to
    construct the radii.

    :param float d: Depth of the angle section
    :param float b: Width of the angle section
    :param float t: Thickness of the angle section
    :param float r_r: Root radius of the angle section
    :param float r_t: Toe radius of the angle section
    :param int n_r: Number of points discretising the radii
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates an angle section with a depth of 150, a width of 100, a thickness
    of 8, a root radius of 12 and a toe radius of 5, using 16 points to discretise the radii. A
    mesh is generated with a maximum triangular area of 2.0::

        from sectionproperties.pre.library.steel_sections import angle_section

        geometry = angle_section(d=150, b=100, t=8, r_r=12, r_t=5, n_r=16)
        geometry.create_mesh(mesh_sizes=[2.0])

    ..  figure:: ../images/sections/angle_geometry.png
        :align: center
        :scale: 75 %

        Angle section geometry.

    ..  figure:: ../images/sections/angle_mesh.png
        :align: center
        :scale: 75 %
    """
    if r_t > t:
        raise ValueError(
            "The radius of the toe (r_t) cannot be larger than the toe thickness (t)."
        )

    points = []

    # add first two points
    points.append([0, 0])
    points.append([b, 0])

    # construct the bottom toe radius
    pt = [b - r_t, t - r_t]
    points += draw_radius(pt, r_t, 0, n_r)

    # construct the root radius
    pt = [t + r_r, t + r_r]
    points += draw_radius(pt, r_r, 1.5 * np.pi, n_r, False)

    # construct the top toe radius
    pt = [t - r_t, d - r_t]
    points += draw_radius(pt, r_t, 0, n_r)

    # add the next point
    points.append([0, d])

    polygon = Polygon(points)
    return geometry.Geometry(polygon, material)
Exemple #5
0
def tee_section(
    d: float,
    b: float,
    t_f: float,
    t_w: float,
    r: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs a Tee section with the top left corner at *(0, d)*, with depth *d*, width *b*,
    flange thickness *t_f*, web thickness *t_w* and root radius *r*, using *n_r* points to
    construct the root radius.

    :param float d: Depth of the Tee section
    :param float b: Width of the Tee section
    :param float t_f: Flange thickness of the Tee section
    :param float t_w: Web thickness of the Tee section
    :param float r: Root radius of the Tee section
    :param int n_r: Number of points discretising the root radius
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates a Tee section with a depth of 200, a width of 100, a flange
    thickness of 12, a web thickness of 6 and a root radius of 8, using 8 points to discretise the
    root radius. A mesh is generated with a maximum triangular area of 3.0::

        from sectionproperties.pre.library.steel_sections import tee_section

        geometry = tee_section(d=200, b=100, t_f=12, t_w=6, r=8, n_r=8)
        geometry.create_mesh(mesh_sizes=[3.0])

    ..  figure:: ../images/sections/tee_geometry.png
        :align: center
        :scale: 75 %

        Tee section geometry.

    ..  figure:: ../images/sections/tee_mesh.png
        :align: center
        :scale: 75 %

        Mesh generated from the above geometry.
    """
    points = []
    # add first two points
    points.append([b * 0.5 - t_w * 0.5, 0])
    points.append([b * 0.5 + t_w * 0.5, 0])

    # construct the top right radius
    pt = [b * 0.5 + t_w * 0.5 + r, d - t_f - r]
    points += draw_radius(pt, r, np.pi, n_r, False)

    # add next four points
    points.append([b, d - t_f])
    points.append([b, d])
    points.append([0, d])
    points.append([0, d - t_f])

    # construct the top left radius
    pt = [b * 0.5 - t_w * 0.5 - r, d - t_f - r]
    points += draw_radius(pt, r, 0.5 * np.pi, n_r, False)

    polygon = Polygon(points)
    return geometry.Geometry(polygon, material)
Exemple #6
0
def channel_section(
    d: float,
    b: float,
    t_f: float,
    t_w: float,
    r: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs a parallel-flange channel (PFC) section with the bottom left corner at the origin *(0, 0)*, with depth *d*,
    width *b*, flange thickness *t_f*, web  thickness *t_w* and root radius *r*, using *n_r* points
    to construct the root radius.

    :param float d: Depth of the PFC section
    :param float b: Width of the PFC section
    :param float t_f: Flange thickness of the PFC section
    :param float t_w: Web thickness of the PFC section
    :param float r: Root radius of the PFC section
    :param int n_r: Number of points discretising the root radius
    :param shift: Vector that shifts the cross-section by *(x, y)*
    :type shift: list[float, float]
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates a PFC section with a depth of 250, a width of 90, a flange
    thickness of 15, a web thickness of 8 and a root radius of 12, using 8 points to discretise the
    root radius. A mesh is generated with a maximum triangular area of 5.0::

        from sectionproperties.pre.library.steel_sections import channel_section

        geometry = channel_section(d=250, b=90, t_f=15, t_w=8, r=12, n_r=8)
        geometry.create_mesh(mesh_sizes=[5.0])

    ..  figure:: ../images/sections/pfc_geometry.png
        :align: center
        :scale: 75 %

        PFC geometry.

    ..  figure:: ../images/sections/pfc_mesh.png
        :align: center
        :scale: 75 %

        Mesh generated from the above geometry.
    """
    points = []

    # add first three points
    points.append([0, 0])
    points.append([b, 0])
    points.append([b, t_f])

    # construct the bottom right radius
    pt = [t_w + r, t_f + r]
    points += draw_radius(pt, r, 1.5 * np.pi, n_r, False)

    # construct the top right radius
    pt = [t_w + r, d - t_f - r]
    points += draw_radius(pt, r, np.pi, n_r, False)

    # add last three points
    points.append([b, d - t_f])
    points.append([b, d])
    points.append([0, d])

    polygon = Polygon(points)
    return geometry.Geometry(polygon, material)
Exemple #7
0
def mono_i_section(
    d: float,
    b_t: float,
    b_b: float,
    t_ft: float,
    t_fb: float,
    t_w: float,
    r: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs a monosymmetric I Section centered at *(max(b_t, b_b)/2, d/2)*, with depth *d*,
    top flange width *b_t*, bottom flange width *b_b*, top flange thickness *t_ft*, top flange
    thickness *t_fb*, web thickness *t_w*, and root radius *r*, using *n_r* points to construct the
    root radius.

    :param float d: Depth of the I Section
    :param float b_t: Top flange width
    :param float b_b: Bottom flange width
    :param float t_ft: Top flange thickness of the I Section
    :param float t_fb: Bottom flange thickness of the I Section
    :param float t_w: Web thickness of the I Section
    :param float r: Root radius of the I Section
    :param int n_r: Number of points discretising the root radius
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates a monosymmetric I Section with a depth of 200, a top flange width
    of 50, a top flange thickness of 12, a bottom flange width of 130, a bottom flange thickness of
    8, a web thickness of 6 and a root radius of 8, using 16 points to discretise the root radius.
    A mesh is generated with a maximum triangular area of 3.0::

        from sectionproperties.pre.library.steel_sections import mono_i_section

        geometry = mono_i_section(
            d=200, b_t=50, b_b=130, t_ft=12, t_fb=8, t_w=6, r=8, n_r=16
        )
        geometry.create_mesh(mesh_sizes=[3.0])

    ..  figure:: ../images/sections/monoisection_geometry.png
        :align: center
        :scale: 75 %

        I Section geometry.

    ..  figure:: ../images/sections/monoisection_mesh.png
        :align: center
        :scale: 75 %

        Mesh generated from the above geometry.
    """
    points = []
    # calculate central axis
    x_central = max(b_t, b_b) * 0.5

    # add first three points
    points.append([x_central - b_b * 0.5, 0])
    points.append([x_central + b_b * 0.5, 0])
    points.append([x_central + b_b * 0.5, t_fb])

    # construct the bottom right radius
    pt = [x_central + t_w * 0.5 + r, t_fb + r]
    points += draw_radius(pt, r, 1.5 * np.pi, n_r, False)

    # construct the top right radius
    pt = [x_central + t_w * 0.5 + r, d - t_ft - r]
    points += draw_radius(pt, r, np.pi, n_r, False)

    # add the next four points
    points.append([x_central + b_t * 0.5, d - t_ft])
    points.append([x_central + b_t * 0.5, d])
    points.append([x_central - b_t * 0.5, d])
    points.append([x_central - b_t * 0.5, d - t_ft])

    # construct the top left radius
    pt = [x_central - t_w * 0.5 - r, d - t_ft - r]
    points += draw_radius(pt, r, 0.5 * np.pi, n_r, False)

    # construct the bottom left radius
    pt = [x_central - t_w * 0.5 - r, t_fb + r]
    points += draw_radius(pt, r, 0, n_r, False)

    # add the last point
    points.append([x_central - b_b * 0.5, t_fb])

    polygon = Polygon(points)
    return geometry.Geometry(polygon, material)
Exemple #8
0
def i_section(
    d: float,
    b: float,
    t_f: float,
    t_w: float,
    r: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:  # More specific description and less ambiguous? e.g. not an "S" section.
    """Constructs an I Section centered at *(b/2, d/2)*, with depth *d*, width *b*, flange
    thickness *t_f*, web thickness *t_w*, and root radius *r*, using *n_r* points to construct the
    root radius.

    :param float d: Depth of the I Section
    :param float b: Width of the I Section
    :param float t_f: Flange thickness of the I Section
    :param float t_w: Web thickness of the I Section
    :param float r: Root radius of the I Section
    :param int n_r: Number of points discretising the root radius
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates an I Section with a depth of 203, a width of 133, a flange
    thickness of 7.8, a web thickness of 5.8 and a root radius of 8.9, using 16 points to
    discretise the root radius. A mesh is generated with a maximum triangular area of 3.0::

        from sectionproperties.pre.library.steel_sections import i_section

        geometry = i_section(d=203, b=133, t_f=7.8, t_w=5.8, r=8.9, n_r=16)
        geometry.create_mesh(mesh_sizes=[3.0])

    ..  figure:: ../images/sections/isection_geometry.png
        :align: center
        :scale: 75 %

        I Section geometry.

    ..  figure:: ../images/sections/isection_mesh.png
        :align: center
        :scale: 75 %

        Mesh generated from the above geometry.
    """
    points = []

    # add first three points
    points.append([0, 0])
    points.append([b, 0])
    points.append([b, t_f])

    # construct the bottom right radius
    pt = [b * 0.5 + t_w * 0.5 + r, t_f + r]
    points += draw_radius(pt, r, 1.5 * np.pi, n_r, False)

    # construct the top right radius
    pt = [b * 0.5 + t_w * 0.5 + r, d - t_f - r]
    points += draw_radius(pt, r, np.pi, n_r, False)

    # add the next four points
    points.append([b, d - t_f])
    points.append([b, d])
    points.append([0, d])
    points.append([0, d - t_f])

    # construct the top left radius
    pt = [b * 0.5 - t_w * 0.5 - r, d - t_f - r]
    points += draw_radius(pt, r, 0.5 * np.pi, n_r, False)

    # construct the bottom left radius
    pt = [b * 0.5 - t_w * 0.5 - r, t_f + r]
    points += draw_radius(pt, r, 0, n_r, False)

    # # add the last point
    points.append([0, t_f])
    i_section = Polygon(points)
    return geometry.Geometry(i_section, material)
Exemple #9
0
def zed_section(
    d: float,
    b_l: float,
    b_r: float,
    l: float,
    t: float,
    r_out: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs a zed section with the bottom left corner at the origin *(0, 0)*, with depth *d*,
    left flange width *b_l*, right flange width *b_r*, lip *l*, thickness *t* and outer radius
    *r_out*, using *n_r* points to construct the radius. If the outer radius is less than the
    thickness of the Zed Section, the inner radius is set to zero.

    :param float d: Depth of the zed section
    :param float b_l: Left flange width of the Zed section
    :param float b_r: Right flange width of the Zed section
    :param float l: Lip of the Zed section
    :param float t: Thickness of the Zed section
    :param float r_out: Outer radius of the Zed section
    :param int n_r: Number of points discretising the outer radius
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates a zed section with a depth of 100, a left flange width of 40, a
    right flange width of 50, a lip of 20, a thickness of 1.2 and an outer radius of 5, using 8
    points to discretise the radius. A mesh is generated with a maximum triangular area of 0.15::

        from sectionproperties.pre.library.steel_sections import zed_section

        geometry = zed_section(d=100, b_l=40, b_r=50, l=20, t=1.2, r_out=5, n_r=8)
        geometry.create_mesh(mesh_sizes=[0.15])

    ..  figure:: ../images/sections/zed_geometry.png
        :align: center
        :scale: 75 %

        zed section geometry.

    ..  figure:: ../images/sections/zed_mesh.png
        :align: center
        :scale: 75 %
    """
    # ensure the lip length is greater than the outer radius
    if l < r_out:
        raise Exception("Lip length must be greater than the outer radius")

    points = []

    # calculate internal radius
    r_in = max(r_out - t, 0)

    # construct the outer bottom left radius
    points += draw_radius([r_out, r_out], r_out, np.pi, n_r)

    # construct the outer bottom right radius
    points += draw_radius([b_r - r_out, r_out], r_out, 1.5 * np.pi, 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 += draw_radius([b_r - t - r_in, t + r_in], r_in, 0, n_r, False)

    # construct the inner bottom left radius
    points += draw_radius([t + r_in, t + r_in], r_in, 1.5 * np.pi, n_r, False)

    # construct the outer top right radius
    points += draw_radius([t - r_out, d - r_out], r_out, 0, n_r)

    # construct the outer top left radius
    points += draw_radius([t - b_l + r_out, d - r_out], r_out, 0.5 * np.pi, 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 += draw_radius([2 * t - b_l + r_in, d - t - r_in], r_in, np.pi, n_r, False)

    # construct the inner top right radius
    points += draw_radius([-r_in, d - t - r_in], r_in, 0.5 * np.pi, n_r, False)
    polygon = Polygon(points)
    return geometry.Geometry(polygon, material)
Exemple #10
0
def cee_section(
    d: float,
    b: float,
    l: float,
    t: float,
    r_out: float,
    n_r: int,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs a Cee section (typical of cold-formed steel) with the bottom left corner at the
    origin *(0, 0)*, with depth *d*, width *b*, lip *l*, thickness *t* and outer radius *r_out*,
    using *n_r* points to construct the radius. If the outer radius is less than the thickness
    of the Cee Section, the inner radius is set to zero.

    :param float d: Depth of the Cee section
    :param float b: Width of the Cee section
    :param float l: Lip of the Cee section
    :param float t: Thickness of the Cee section
    :param float r_out: Outer radius of the Cee section
    :param int n_r: Number of points discretising the outer radius
    :raises Exception: Lip length must be greater than the outer radius
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with this geometry

    The following example creates a Cee section with a depth of 125, a width of 50, a lip of 30, a
    thickness of 1.5 and an outer radius of 6, using 8 points to discretise the radius. A mesh is
    generated with a maximum triangular area of 0.25::

        from sectionproperties.pre.library.steel_sections import cee_section

        geometry = cee_section(d=125, b=50, l=30, t=1.5, r_out=6, n_r=8)
        geometry.create_mesh(mesh_sizes=[0.25])

    ..  figure:: ../images/sections/cee_geometry.png
        :align: center
        :scale: 75 %

        Cee section geometry.

    ..  figure:: ../images/sections/cee_mesh.png
        :align: center
        :scale: 75 %
    """
    # ensure the lip length is greater than the outer radius
    if l < r_out:
        raise Exception("Lip length must be greater than the outer radius")

    points = []

    # calculate internal radius
    r_in = max(r_out - t, 0)

    # construct the outer bottom left radius
    points += draw_radius([r_out, r_out], r_out, np.pi, n_r)

    # construct the outer bottom right radius
    points += draw_radius([b - r_out, r_out], r_out, 1.5 * np.pi, 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 += draw_radius([b - t - r_in, t + r_in], r_in, 0, n_r, False)

    # construct the inner bottom left radius
    points += draw_radius([t + r_in, t + r_in], r_in, 1.5 * np.pi, n_r, False)

    # construct the inner top left radius
    points += draw_radius([t + r_in, d - t - r_in], r_in, np.pi, n_r, False)

    # construct the inner top right radius
    points += draw_radius([b - t - r_in, d - t - r_in], r_in, 0.5 * np.pi, n_r, 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 += draw_radius([b - r_out, d - r_out], r_out, 0, n_r)

    # construct the outer top left radius
    points += draw_radius([r_out, d - r_out], r_out, 0.5 * np.pi, n_r)

    polygon = Polygon(points)
    return geometry.Geometry(polygon, material)
Exemple #11
0
def bulb_section(
    d: float,
    b: float,
    t: float,
    r: float,
    n_r: int,
    d_b: float = None,
    material: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.Geometry:
    """Constructs a bulb section with the bottom left corner at the point
    *(-t / 2, 0)*, with depth *d*, bulb depth *d_b*, bulb width *b*, web thickness *t*
    and radius *r*, using *n_r* points to construct the radius.

    :param float d: Depth of the section
    :param float b: Bulb width
    :param float t: Web thickness
    :param float r: Bulb radius
    :param float d_b: Depth of the bulb (automatically calculated for standard sections,
        if provided the section may have sharp edges)
    :param int n_r: Number of points discretising the radius
    :param Optional[sectionproperties.pre.pre.Material]: Material to associate with
        this geometry

    The following example creates a bulb section with a depth of 240, a width of 34, a
    web thickness of 12 and a bulb radius of 16, using 16 points to discretise the
    radius. A mesh is generated with a maximum triangular area of 5.0::

        from sectionproperties.pre.library.steel_sections import bulb_section

        geometry = bulb_section(d=240, b=34, t=12, r=10, n_r=16)
        geometry.create_mesh(mesh_sizes=[5.0])

    ..  figure:: ../images/sections/bulb_geometry.png
        :align: center
        :scale: 75 %

        Bulb section geometry.

    ..  figure:: ../images/sections/bulb_mesh.png
        :align: center
        :scale: 75 %

        Mesh generated from the above geometry.
    """

    if d_b is None:
        d_b = r * np.cos(np.pi / 3) / np.cos(np.pi / 6) + r + b * np.tan(np.pi / 6)

    points = []

    # add first two points
    points.append([-t * 0.5, 0])
    points.append([t * 0.5, 0])

    # test of additional radius
    dc = r / np.sin(2 / 3 * np.pi / 2)
    ptb0 = [t * 0.5 + dc * np.cos(np.pi / 6), d - d_b - dc * np.cos(np.pi / 3)]
    points += draw_radius(ptb0, r, np.pi, n_r, False, np.pi / 3)

    # end of test of additional radius
    ptb = [b + t * 0.5 - r, d - r]
    dzero = ((b + t * 0.5 - r - t * 0.5) ** 2 + (d - r - d + d_b) ** 2) ** 0.5

    # build radius
    points += draw_radius(ptb, r, -np.pi * 1 / 3, n_r, True, np.pi / 3)
    points += draw_radius(ptb, r, 0, n_r, True)

    # build the top part
    points.append([b + t * 0.5 - r, d])
    points.append([-t * 0.5, d])

    polygon = Polygon(points)
    return geometry.Geometry(polygon, material)