From 90376cfcbcee5cba831acb3fc4702cba7facd32d Mon Sep 17 00:00:00 2001 From: robbievanleeuwen Date: Sat, 30 Sep 2023 22:01:39 +1000 Subject: [PATCH] Fix progress bar not working for geometric and plastic analysis --- src/sectionproperties/analysis/plastic_section.py | 10 +++++----- src/sectionproperties/analysis/section.py | 14 +++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/sectionproperties/analysis/plastic_section.py b/src/sectionproperties/analysis/plastic_section.py index 9e1ec359..1f03994b 100644 --- a/src/sectionproperties/analysis/plastic_section.py +++ b/src/sectionproperties/analysis/plastic_section.py @@ -94,7 +94,7 @@ def calculate_plastic_properties( if verbose: self.print_verbose(d=y_pc, root_result=r, axis="x-axis") - if progress and task: + if progress and task is not None: progress.update(task_id=task, advance=1) # 1b) Calculate y-axis plastic centroid @@ -112,7 +112,7 @@ def calculate_plastic_properties( if verbose: self.print_verbose(d=x_pc, root_result=r, axis="y-axis") - if progress and task: + if progress and task is not None: progress.update(task_id=task, advance=1) # 2) Calculate plastic properties for principal axis @@ -152,7 +152,7 @@ def calculate_plastic_properties( if verbose: self.print_verbose(d=y22_pc, root_result=r, axis="11-axis") - if progress and task: + if progress and task is not None: progress.update(task_id=task, advance=1) # 2b) Calculate 22-axis plastic centroid @@ -178,7 +178,7 @@ def calculate_plastic_properties( if verbose: self.print_verbose(d=x11_pc, root_result=r, axis="22-axis") - if progress and task: + if progress and task is not None: progress.update(task_id=task, advance=1) # if there are no materials specified, calculate shape factors @@ -220,7 +220,7 @@ def calculate_plastic_properties( section.section_props.s22 / section.section_props.z22_minus ) - if progress and task: + if progress and task is not None: progress.update( task_id=task, description="[bold green]:white_check_mark: Plastic analysis complete", diff --git a/src/sectionproperties/analysis/section.py b/src/sectionproperties/analysis/section.py index 4071876f..7ef7b890 100644 --- a/src/sectionproperties/analysis/section.py +++ b/src/sectionproperties/analysis/section.py @@ -257,7 +257,7 @@ def calculate_geom(progress: Progress | None = None) -> None: self.section_props.iyy_g += iyy_g * e self.section_props.ixy_g += ixy_g * e - if progress and task: + if progress and task is not None: progress.update(task_id=task, advance=1) self.section_props.nu_eff = ( @@ -270,7 +270,7 @@ def calculate_geom(progress: Progress | None = None) -> None: node_list=self.mesh["vertices"] ) - if progress and task: + if progress and task is not None: msg = "[bold green]:white_check_mark: Geometric analysis complete" progress.update(task_id=task, description=msg) @@ -880,7 +880,7 @@ def calculate_geom(progress: Progress | None = None) -> None: self.section_props.iyy_g += iyy_g * e self.section_props.ixy_g += ixy_g * e - if progress and task: + if progress and task is not None: progress.update(task_id=task, advance=1) # calculate elastic centroid location @@ -916,7 +916,7 @@ def calculate_geom(progress: Progress | None = None) -> None: else: self.section_props.phi = np.arctan2(ixx_c - i11_c, ixy_c) * 180 / np.pi - if progress and task: + if progress and task is not None: msg = "[bold green]:white_check_mark: Geometric analysis complete" progress.update(task_id=task, description=msg) @@ -1055,7 +1055,7 @@ def solve_warping() -> np.ndarray: progress_table = Table.grid() panel = Panel.fit( renderable=progress, - title="[bold]Warping Analysis", + title="[bold]Warping (Frame) Analysis", border_style="red", padding=(1, 1), ) @@ -1565,10 +1565,6 @@ def plot_mesh( cmap = ListedColormap(colors=color_array) # custom colormap - # from rich.pretty import pprint - # pprint(len(self._mesh_nodes)) - # pprint(self._mesh_elements.max()) - # plot the mesh colors ax.tripcolor( self._mesh_nodes[:, 0],