simdesign.rcmrf.geometry.base
Frame geometry base module for RC moment-resisting frame structures.
Provides the abstract base class GeometryBase, concrete shape
classes Line and Rectangle, and grid-data helpers
- class simdesign.rcmrf.geometry.base.Line(points, tag=None, rot_angle=0.0, component=None)[source]
Bases:
LineLine element with RC-frame-specific attributes.
Extends
Linewith a section rotation angle, a structural component label, and a staircase membership flag.- Variables:
rot_angle (float) – Rotation angle of the element section in degrees, measured counterclockwise from the positive x-axis. Defaults to 0.0. Convention: right (X+) = 0°, up (Y+) = 90°, left (X-) = ±180°, down (Y-) = -90°.
component ({'Beam', 'Column'} or None) – Structural component type the line represents.
stairs (bool) –
Trueif the line is part of the staircase system.
- Parameters:
points (List[Point])
tag (int | None)
rot_angle (float)
component (Literal['Beam', 'Column'] | None)
- stairs: bool = False
- rot_angle: float = 0.0
- component: Literal['Beam', 'Column'] | None = None
- class simdesign.rcmrf.geometry.base.Rectangle(points, lines=None, tag=None, component=None, typology=None)[source]
Bases:
RectangleRectangle element with RC-frame-specific attributes.
Extends
Rectanglewith a structural component label, infill typology, associated lines, and a staircase flag.- Variables:
component ({'Slab', 'Stairs', 'Infill'} or None) – Structural component type the rectangle represents.
typology ({'Weak', 'Medium', 'Strong'} or None) – Infill strength typology.
lines (list or None) – Lines composing the rectangle boundary.
stairs (bool) –
Trueif the rectangle is part of the staircase system.
- Parameters:
- stairs: bool = False
- component: Literal['Slab', 'Stairs', 'Infill'] | None = None
- typology: Literal['Weak', 'Medium', 'Strong'] | None = None
- class simdesign.rcmrf.geometry.base.GridData(ids, ordinates)[source]
Bases:
objectA class representing grid data along a specific axis.
- Variables:
ids (List[Union[int, float]]) – Grid identifiers.
ordinates (List[float]) – Grid ordinates.
- Parameters:
ids (List[int | float])
ordinates (List[float])
- ids: List[int | float]
- ordinates: List[float]
- class simdesign.rcmrf.geometry.base.SystemGridData(points)[source]
Bases:
objectA class representing the data for the entire grid system.
- Variables:
- Parameters:
points (List[Point])
- update_data(points)[source]
Update grid data based on the provided list of points.
- Parameters:
points (List[Point]) – The list of points used to update grid data.
- Return type:
None
- class simdesign.rcmrf.geometry.base.GeometryBase[source]
Bases:
ABCAbstract base class for representing a frame structure geometry.
- Variables:
points (List[Point]) – List of points in the frame.
lines (List[Line]) – List of lines in the frame.
rectangles (List[Rectangle]) – List of rectangles in the frame.
stairs_lines (List[List[Line]]) – List of lines representing stairs in the frame.
system_grid_data (SystemGridData) – Grid data for the entire frame.
stairs_width_x (float) – Width of stairs along the x-axis.
stairs_width_y (float) – Width of stairs along the y-axis.
stairs_location (List[int]) – Location of stairs defined by grid ids in x and y for lower left corner point.
POINTS_SHEET (str) – Sheet name for points data in Excel. Default is “Points”.
LINES_SHEET (str) – Sheet name for lines data in Excel. Default is “Lines”.
RECTANGLES_SHEET (str) – Sheet name for rectangles data in Excel. Default is “Rectangles”.
STAIRS_SHEET (str) – Sheet name for stairs data in Excel. Default is “Stairs Locations”.
ALLOWED_LINE_UNIT_VECTORS (Tuple[list]) – Tuple of allowed unit vectors for lines. Default is ([1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]).
ALLOWED_RECTANGLE_UNIT_NORMAL_VECTORS (list) – Allowed unit normal vectors for rectangles. Default is ([0.0, 0.0, -1.0], [0.0, 1.0, 0.0], [-1.0, 0.0, 0.0])
Notes
Always add staircase lines and points after finalising the base geometry.
Staircase line layout (per staircase bay):
yz-view: x=i yz-view: x=i+1 z12|__x1__|z22 __x2__ z12| |z21 | | z3 z4- system_grid_data: SystemGridData
- stairs_width_x
alias of
float
- stairs_width_y
alias of
float
- stairs_location
alias of
List[int]
- POINTS_SHEET: str = 'Points'
- LINES_SHEET: str = 'Lines'
- RECTANGLES_SHEET: str = 'Rectangles'
- ALLOWED_LINE_UNIT_VECTORS: Tuple[List[float]] = ([1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0])
- ALLOWED_RECTANGLE_UNIT_NORMAL_VECTORS: List[float] = ([0.0, 0.0, -1.0], [0.0, 1.0, 0.0], [-1.0, 0.0, 0.0])
- property slab_rectangles: List[Rectangle]
Rectangles whose component is
'Slab'.- Returns:
The list of rectangles representing the slabs in the frame.
- Return type:
List[Rectangle]
- property stairs_rectangles: List[Rectangle]
Rectangles whose component is
'Stairs'.- Returns:
The list of rectangles representing the stairs in the frame.
- Return type:
List[Rectangle]
- property infill_rectangles: List[Rectangle]
Rectangles whose component is
'Infill'.- Returns:
The list of rectangles representing the Infills in the frame.
- Return type:
List[Rectangle]
- property beam_lines: List[Line]
Lines whose component is
'Beam'.- Returns:
The list of lines representing the beams in the frame.
- Return type:
List[Line]
- property column_lines: List[Line]
Lines whose component is
'Column'.- Returns:
The list of lines representing the columns in the frame.
- Return type:
List[Line]
- property lines_x: List[Line]
Lines whose unit vector is aligned with the X-axis.
- Returns:
Lines along X-axis.
- Return type:
List[Line]
- property lines_y: List[Line]
Lines whose unit vector is aligned with the Y-axis.
- Returns:
Lines along Y-axis.
- Return type:
List[Line]
- property lines_z: List[Line]
Lines whose unit vector is aligned with the Z-axis.
- Returns:
Lines along Z-axis.
- Return type:
List[Line]
- property lines_z_facades: List[Literal[0, 1, 2, 3, 4]]
Facade location IDs of lines along the Z-axis.
- Returns:
Facade IDs of lines along Z-axis.
- Return type:
List[Literal[0, 1, 2, 3, 4]]
Notes
At the moment, does not work for irregular frames.
TODO
Adapt it for irregular frames.
- property continuous_lines_along_x: Dict[Tuple[float | int], List[Line]]
Lines grouped into continuous runs along the X-direction.
- Returns:
Continuous lines along the X-direction.
- Return type:
Dict[Tuple[Union[float, int]], List[Line]]
Notes
In case there are None’s in the lists, it means that there is a discontinuity at None.
- property continuous_lines_along_y: Dict[Tuple[float | int], List[Line]]
Lines grouped into continuous runs along the Y-direction.
- Returns:
Continuous lines along the Y-direction.
- Return type:
Dict[Tuple[Union[float, int]], List[Line]]
Notes
In case there are None’s in the lists, it means that there is a discontinuity at None.
- property continuous_lines_along_z: Dict[Tuple[float | int], List[Line]]
Lines grouped into continuous runs along the Z-direction.
- Returns:
Continuous lines along the Z-direction.
- Return type:
Dict[Tuple[Union[float, int]], List[Line]]
Notes
In case there are None’s in the lists, it means that there is a discontinuity at None.
- property ground_level_points: List[Point]
First (lowest) point of each continuous vertical line group.
- Returns:
Ground level points (first points of continuous lines).
- Return type:
List[Point]
- property points_at_mid_floor_levels: List[Point]
End-points of all mid-storey staircase beams (
stairs_lines_x1).- Returns:
Points at mid floor levels (points of stairs_lines_x1).
- Return type:
List[Point]
- property floor_level_points: List[List[Point]]
Points grouped by floor level, excluding ground and mid-storey nodes.
- Returns:
List which contains lists of points at each floor level.
- Return type:
List[List[Point]]
- property point_tags: List[int]
Integer tags of all points in the frame.
- Returns:
Tags of defined points.
- Return type:
List[int]
- property line_tags: List[int]
Integer tags of all lines in the frame.
- Returns:
Tags of defined lines.
- Return type:
List[int]
- property rectangle_tags: List[int]
Integer tags of all rectangles in the frame.
- Returns:
Tags of defined rectangles.
- Return type:
List[int]
- property roof_rectangles: List[Rectangle]
Rectangles at the topmost occupied floor level.
- Returns:
Rectangles at the roof level.
- Return type:
List[Rectangle]
- property exterior_horizontal_lines: List[Line]
Horizontal lines on the exterior perimeter of the frame.
- Returns:
Exterior horizontal lines.
- Return type:
List[Line]
Notes
Does not consider the lines around interior openings as exterior.
- property stairs_lines_z11: List[Line]
Lower halves of the z1 vertical lines on the first staircase side.
- Returns:
List of stairs z11 lines.
- Return type:
List[Line]
Notes
The vertical z1 line is divided into two since an horizontal line along x-axis (x1), which represents the supporting beam at the mid-storey level, is inserted. z11 line is the lower half of the original vertical line. It is connected to the start point of mid horizontal line (x1).
- property stairs_lines_z12: List[Line]
Upper halves of the z1 vertical lines on the first staircase side.
- Returns:
List of stairs z12 lines.
- Return type:
List[Line]
Notes
The vertical z1 line is divided into two since an horizontal line along x-axis (x1), which represents the supporting beam at the mid-storey level, is inserted. z12 line is the upper half of the original vertical line. It is connected to the start point of mid horizontal line (x1).
- property stairs_lines_z21: List[Line]
Lower halves of the z2 vertical lines on the second staircase side.
- Returns:
List of stairs z21 lines.
- Return type:
List[Line]
Notes
The vertical z2 line is divided into two since an horizontal line along x-axis (x1), which represents the supporting beam at the mid-storey level, is inserted. z21 line is the lower half of the original vertical line. It is connected to the end point of mid horizontal line (x1).
- property stairs_lines_z22: List[Line]
Upper halves of the z2 vertical lines on the second staircase side.
- Returns:
List of stairs z22 lines.
- Return type:
List[Line]
Notes
The vertical z2 line is divided into two since an horizontal line along x-axis (x1), which represents the supporting beam at the mid-storey level, is inserted. z22 line is the upper half of the original vertical line. It is connected to the end point of mid horizontal line (x1).
- property stairs_lines_z3: List[Line]
Vertical lines connected to the start of the floor-level beam (x2).
- Returns:
List of stairs z3 lines.
- Return type:
List[Line]
Notes
It is connected to the start point of upper horizontal line along x-axis (x2), which represents the supporting beam at the floor level, is inserted.
- property stairs_lines_z4: List[Line]
Vertical lines connected to the end of the floor-level beam (x2).
- Returns:
List of stairs z4 lines.
- Return type:
List[Line]
Notes
It is connected to the end point of upper horizontal line along x-axis (x2), which represents the supporting beam at the floor level, is inserted.
- property stairs_lines_x1: List[Line]
Mid-storey staircase supporting beams (x1).
- Returns:
Stairs x1 lines.
- Return type:
List[Line]
Notes
x1 line represents the supporting beam at the mid-storey level.
- property stairs_lines_x2: List[Line]
Floor-level staircase supporting beams (x2).
- Returns:
Staircase supporting lines along x-axis (beams) at storey level.
- Return type:
List[Line]
Notes
x2 line represents the supporting beam at the floor level.
- find_point_by_tag(tag)[source]
Find a point in the frame by its tag.
- Parameters:
tag (int) – The tag of the point to find.
- Returns:
The point with the specified tag if found, otherwise None.
- Return type:
Optional[Point]
- find_point_by_grid_ids(grid_ids)[source]
Find a point in the frame by its grid ids.
- Parameters:
grid_ids (List[Union[int, float]]) – The grid ids of the point to find.
- Returns:
The point with the specified grid ids if found, otherwise None.
- Return type:
Optional[Point]
- find_points_by_level(z_grid_id)[source]
Find points in the frame that belong to a specific level.
- Parameters:
z_grid_id (Union[int, float]) – The grid id representing the level along the z-axis.
- Returns:
A list of points belonging to the specified level if found, otherwise None.
- Return type:
Optional[List[Point]]
- find_point_by_coordinates(coordinates)[source]
Find a point in the frame based on its coordinates.
- Parameters:
coordinates (List[float]) – The coordinates [x, y, z] of the point to search for.
- Returns:
The point object if found, otherwise None.
- Return type:
Optional[Point]
- find_line_by_tag(tag)[source]
Find a line in the frame based on its tag.
- Parameters:
tag (int) – The tag of the line to be found.
- Returns:
The line object if found, otherwise None.
- Return type:
Optional[Line]
- find_rectangle_by_tag(tag)[source]
Find a rectangle in the frame based on its tag.
- Parameters:
tag (int) – The tag of the rectangle to be found.
- Returns:
The rectangle object if found, otherwise None.
- Return type:
Optional[Rectangle]
- find_rectangles_by_line(line)[source]
Find all rectangles in the frame that contain the given line.
- find_rectangles_by_point(point)[source]
Find all rectangles in the frame that contain the given point.
- find_rectangles_by_left_lower_point(point)[source]
Find the rectangle in the frame with the given left-lower corner point.
- write_mesh_to_xlsx(path)[source]
Write the mesh data to an Excel file.
The mesh data includes information about points, lines (beams), and rectangles (slabs or stairs). The data is written to separate sheets in the Excel file.
- Parameters:
path (Union[str, Path]) – The file path where the Excel file will be saved.
- Return type:
None
Notes
This method uses the openpyxl engine for writing to Excel files.
- set_continuous_stairs_rectangles(location, width_x=None, width_y=None)[source]
Set the rectangles which are located along the staircase (-Z).
The rectangle location is set based on the grid ids of the left corner point. The rectangle dimensions along the staircase case are modified based on the user input.
- Parameters:
location (List[int]) – Grid ids in x and y for lower left corner point.
width_x (float) – The width of rectangle containing stairs in x direction. If None, width will not be changed, by default None.
width_y (float) – The width of rectangle containing stairs in y direction. If None, width will not be changed, by default None.
- Return type:
None
Notes
The staircase is assumed to be continuous along all the floors. In other words, the geometry should contain rectangles at each floor at the same location in xy plane.
- add_new_elements_for_stairs()[source]
Add new lines (beams) and connecting points for supporting stairs.
This method adds new lines and points to represent stairs in the frame. It identifies rectangles that represent stairs and generates additional points and lines for each staircase within those rectangles. For each staircase, it creates two additional points at mid-storey height, divides the vertical lines passing through these points into two, and adds a beam between the two nodes supporting the staircase loads.
Notes
Ensure to add the lines and points for stairs after finalizing the base geometry.
The grid IDs at the stair line levels should always end with ‘.5’. For example, for stairs between floor one and two the grid id will be 1.5.
Do not update the grid system after using this method.
TODO
Improve the the behaviour grid id restrictions of stairs.
Add option for defining the supporting beam location
- Return type:
None
- get_points()[source]
Get all points in the frame.
- Returns:
A list containing all points in the frame.
- Return type:
List[Point]
- get_lines()[source]
Get all lines in the frame.
- Returns:
A list containing all lines in the frame.
- Return type:
List[Line]
- get_slabs_rectangles()[source]
Get all slab rectangles in the frame.
- Returns:
A list containing all slab rectangles in the frame.
- Return type:
List[Rectangle]
- get_stairs_rectangles()[source]
Get all stairs rectangles in the frame.
- Returns:
A list containing all stairs rectangles in the frame.
- Return type:
List[Rectangle]
- export_mesh_to_html(path)[source]
Export the mesh data to an HTML file.
This method exports the mesh data, including points, lines, and rectangles, to an HTML file for visualization.
- Parameters:
path (str) – The file path of the HTML file to export the mesh data to.
- Return type:
None
Notes
The exported HTML file contains visual representations of the mesh data using Three.js for 3D rendering.
- show_mesh()[source]
Display the mesh data.
This method displays the mesh data, including points, lines, and rectangles, using a graphical user interface (GUI) for visualization.
Notes
The method opens a window or interface to visualize the mesh data.
- Return type:
None
- modify_floor_height(floor_id, new_height)[source]
Modify the height of a floor level in the frame.
This method adjusts the height of a specific floor level in the frame by updating the z-coordinates of the points associated with that level and adjusting the grid accordingly.
- Parameters:
floor_id (Union[int, float]) – The identifier of the floor level to be modified. It corresponds to the associated grid id of the floor in -z direction.
new_height (float) – The new height to set for the specified floor level.
- Return type:
None
- modify_bay_width(bay_id, width, direction)[source]
Modify the width of a bay in the frame.
This method adjusts the width of a specific bay in the frame by updating the x-coordinates or y-coordinates of the points associated with that bay and adjusting the grid accordingly.
- Parameters:
bay_id (int) – The identifier of the bay to be modified. It corresponds to the associated grid id of the floor in -x or -y direction.
width (float) – The new width to set for the specified bay.
direction ({'x', 'y'}) – The direction along which to modify the bay width. ‘x’ indicates modification along the x-axis, ‘y’ indicates modification along the y-axis.
- Return type:
None
Notes
This method updates the x-coordinates or y-coordinates of the points belonging to the specified bay and adjusts the grid system accordingly to reflect the changes in bay width along the specified direction.
- remove_rectangle(left_lower_point_grid_ids, remove_lines=True, remove_points=True)[source]
Remove a rectangle from the frame.
This method removes a rectangle from the frame based on the grid IDs of its left-lower point. It also provides options to remove lines and points only associated with removed rectangle.
- Parameters:
left_lower_point_grid_ids (List[int]) – The grid IDs of the left-lower point of the rectangle to be removed.
remove_lines (bool, optional) – Whether to remove associated lines, by default True.
remove_points (bool, optional) – Whether to remove associated points, by default True.
- Return type:
None
Notes
This method first identifies the rectangle based on the grid IDs of its left-lower point. It then removes associated lines and points based on the specified parameters.
If remove_lines is True, lines that are only associated with the removed rectangle are removed.
Similarly, if remove_points is True, points that are only associated with the removed rectangle are removed.
- add_new_point(coordinates, tag=None)[source]
Add a new point to the frame.
This method adds a new point to the frame with the specified coordinates and optional tag. If a point with the same coordinates already exists, a warning is issued.
- Parameters:
coordinates (List[float]) – The coordinates [x, y, z] of the new point.
tag (Optional[int], optional) – The tag to assign to the new point. If None or if the provided tag already exists, a new tag is automatically assigned, by default None.
- Returns:
The newly created or existing point object.
- Return type:
Notes
If the provided tag is None or if it already exists in the frame, the method automatically assigns a new tag by incrementing the maximum tag value found in the frame.
The method also updates the system grid data based on the newly added point and updates the grid IDs of existing points accordingly.
- add_new_line(points, tag=None, component=None, orientation=0.0)[source]
Add a new line to the frame.
This method adds a new line to the frame with the specified points and optional tag. If a line with the same points already exists, a warning is issued.
- Parameters:
points (List[Point]) – The list of points that define the new line.
tag (Optional[int], optional) – The tag to assign to the new line. If None or if the provided tag already exists, a new tag is automatically assigned, by default None.
component (Optional[Literal['Beam', 'Column']]) – Type of component whose axis is represented by the line geometry; ‘Beam’ or ‘Column’. By default None
orientation (float) – The rotation angle of the element section in degrees, measured counterclockwise from the positive x-axis. By default 0.0.
- Returns:
The newly created or existing line object.
- Return type:
Notes
If the provided tag is None or if it already exists in the frame, the method automatically assigns a new tag by incrementing the maximum tag value found in the frame.
The method also ensures that the points defining the line are sorted in ascending order of their x and y coordinates for consistency.
- add_new_rectangle(points, tag=None, component=None, strength=None, create_lines=False)[source]
Add a new rectangle to the frame.
This method adds a new rectangle to the frame with the specified corner points and optional tag. If a rectangle with the same points already exists, a warning is issued.
- Parameters:
points (List[Point]) – The list of four points that define the rectangle.
tag (Optional[int], optional) – The tag to assign to the new rectangle. If None or if the provided tag already exists, a new tag is automatically assigned, by default None.
component (Optional[Literal['Slab', 'Stairs', 'Infill']]) – The type of structural component which is represented by the rectangle. By default None.
strength (Optional[Literal['Weak', 'Medium', 'Strong']]) – The category of infill strength. By default None.
create_lines (bool)
- Returns:
The newly created or existing rectangle object.
- Return type:
Notes
If the provided tag is None or if it already exists in the frame, the method automatically assigns a new tag by incrementing the maximum tag value found in the frame.
The method also ensures that the lines defining the rectangle are created if they do not exist, and the rectangle points are sorted to maintain consistency.
- uniformise(bay_width_x=None, bay_width_y=None, storey_height=None)[source]
Uniformise the bay width and storey heights of the frame structure.
This method uniformly scales the frame structure based on the provided bay widths and storey height.
- Parameters:
bay_width_x (Optional[float], optional) – The width of each bay in the x-direction, by default None.
bay_width_y (Optional[float], optional) – The width of each bay in the y-direction, by default None.
storey_height (Optional[float], optional) – The height of each storey, by default None.
- Return type:
None