3.5. Helpers

There are a number of helper funcitons limitstates that can be used to help with common tasks, such as parse through sections, or read from a database. The following is an overview of these useful functions.

3.5.1. Filtering Functions

Contains functions for sorting collections of limitstate objects

filterByAttrRange(objectList: list, attr: str, lowerLim=None, upperLim=None)[source]

Filter a list of objects using an upper and lower limit.

Parameters
  • objectList (list) – The sections to sort.

  • attr (str) – The attribute to sort by.

  • lowerLim (bool, optional) – The lower limit of the attribute.

  • upperLim (bool, optional) – The upper limit of the attribute.

Returns

The filtered list.

Return type

list

filterByName(objectList: list, filterVal: str)[source]

Finds all sections that hve the string of filterVal in it’s name.

Parameters
  • objectList (list) – The sections to sort.

  • filterVal (str) – The string to check if is in any names.

Returns

The filtered list.

Return type

list

getByName(objectList: list, filterVal: str)[source]

Returns the first object that has the string of filterVal in it’s name. Results are not case sensetive.

Parameters
  • objectList (list) – The sections to sort.

  • filterVal (str) – The string to check if is in any names.

Returns

The filtered list.

Return type

list

sortByAttr(objectList: list, attr: str, reverse: bool = False)[source]

Sort a list of objects by input attribute from smallest to largest.

Parameters
  • objectList (list) – The sections to sort.

  • attr (str) – The attribute to sort by.

  • reverse (bool, optional) – A flag that allows the list to be reversed. The default is True.

Returns

The sorted list.

Return type

list

3.5.2. Reading Functions

The read module contains common functions for reading material or section databases.

The functions getSteelSections and getRectangularSections are intended for for users to use directly.

Material DB functions are not inteded for use by user, instead they should use material files from the specific design library they are targeting.

getRectangularSections(mat: MaterialAbstract, code: str, dbType: str, fileName: str) list[limitstates.objects.section.section.SectionRectangle][source]

Creates a set of rectangular sections from a input database. The units the database are decided based on what code it’s in, with canadian given units of mm, and american codes given units of in.

Parameters
  • mat (MaterialAbstract) – The material to be applied to the sections.

  • code (str) – The code to use, can be one of ‘csa’ or ‘us’.

  • dbType (str) – The type of section to use, i.e. glulam.

  • fileName (str) – The specific database file to read from.

Returns

sections – A list of rectangular sections from the database.

Return type

list[SectionRectangle]

getSteelSections(mat: MaterialAbstract, code: str, dbName: str, steelShapeType: str) list[limitstates.objects.section.section.SectionSteel][source]

Returns a list of steel sections from a section database. The section database must be one of the steel databases here: https://limitstates.readthedocs.io/en/latest/rst/objects-section-db.html

Parameters
  • mat (MaterialAbstract) – The material to apply to each section.

  • code (str) – The code to use, can be one of ‘csa’ or ‘us’.

  • dbType (str) – The type of database to use, i.e. aisc, cisc

  • steelShapeType (str) – The type of steel section to load, i.e. W, hss.

Returns

The steel sections from the input database.

Return type

list[SectionSteel]