From c375d2866078724ef12be82ca7a05a2d8e0a0024 Mon Sep 17 00:00:00 2001 From: MPCBBishop Date: Fri, 6 Dec 2024 19:26:56 +0800 Subject: [PATCH 1/3] Fix method keyword args Fix `add_member_dist_load` and `add_node_load` method in `Braced Frame - Tension Only.py` and `Moment Frame - Lateral Load.py`. Change kwargs from `Direction` to `direction`. --- Examples/Braced Frame - Tension Only.py | 10 +++++----- Examples/Moment Frame - Lateral Load.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Examples/Braced Frame - Tension Only.py b/Examples/Braced Frame - Tension Only.py index 31a47a2..b0ad87b 100644 --- a/Examples/Braced Frame - Tension Only.py +++ b/Examples/Braced Frame - Tension Only.py @@ -76,18 +76,18 @@ # to the full member length. Note also that the direction uses lowercase # notations to indicate member local coordinate systems. Brace loads have been # neglected. -braced_frame.add_member_dist_load('Beam', Direction='Fy', w1=-0.024/12, +braced_frame.add_member_dist_load('Beam', direction='Fy', w1=-0.024/12, w2=-0.024/12, x1=0, x2=15*12, case='D') -braced_frame.add_member_dist_load('Col1', Direction='Fx', w1=-0.033/12, +braced_frame.add_member_dist_load('Col1', direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D') -braced_frame.add_member_dist_load('Col2', Direction='Fx', w1=-0.033/12, +braced_frame.add_member_dist_load('Col2', direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D') # Add nodal wind loads of 25 kips to each side of the frame. Note that the # direction uses uppercase notation to indicate model global coordinate # system. -braced_frame.add_node_load('N2', Direction='FX', P=25, case='W') -braced_frame.add_node_load('N3', Direction='FX', P=25, case='W') +braced_frame.add_node_load('N2', direction='FX', P=25, case='W') +braced_frame.add_node_load('N3', direction='FX', P=25, case='W') # Create load combinations # Note that the load combination '1.4D' has no lateral load, but does have diff --git a/Examples/Moment Frame - Lateral Load.py b/Examples/Moment Frame - Lateral Load.py index f9b32e5..297a1c4 100644 --- a/Examples/Moment Frame - Lateral Load.py +++ b/Examples/Moment Frame - Lateral Load.py @@ -48,13 +48,13 @@ # Add self weight dead loads to the frame # Note that we could leave 'x1' and 'x2' undefined below and it would default to the full member length # Note also that the direction uses lowercase notations to indicate member local coordinate systems -MomentFrame.add_member_dist_load('Beam', Direction='Fy', w1=-0.024/12, w2=-0.024/12, x1=0, x2=15*12, case='D') -MomentFrame.add_member_dist_load('Col1', Direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D') -MomentFrame.add_member_dist_load('Col2', Direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D') +MomentFrame.add_member_dist_load('Beam', direction='Fy', w1=-0.024/12, w2=-0.024/12, x1=0, x2=15*12, case='D') +MomentFrame.add_member_dist_load('Col1', direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D') +MomentFrame.add_member_dist_load('Col2', direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D') # Add a nodal wind load of 10 kips at the left side of the frame # Note that the direction uses uppercase notation to indicate model global coordinate system -MomentFrame.add_node_load('N2', Direction='FX', P=10, case='W') +MomentFrame.add_node_load('N2', direction='FX', P=10, case='W') # Create two load combinations MomentFrame.add_load_combo('1.2D+1.0W', factors={'D':1.2, 'W':1.0}) From 4ee865975cc424b965b088910696c5318d9af518 Mon Sep 17 00:00:00 2001 From: MPCBBishop Date: Fri, 6 Dec 2024 19:30:48 +0800 Subject: [PATCH 2/3] Fix render code in examples Due to commit 668e69279cd985a704b91c4e0303e3865039d304 , `render_model` is deprecated. So change it to `Rendered` class. --- Examples/Circular Bin with Conical Hopper.py | 10 ++++++++-- Examples/Moment Frame - Lateral Load.py | 9 +++++++-- Examples/Space Frame - Nodal Loads 2.py | 12 +++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Examples/Circular Bin with Conical Hopper.py b/Examples/Circular Bin with Conical Hopper.py index 3d15008..bc723f5 100644 --- a/Examples/Circular Bin with Conical Hopper.py +++ b/Examples/Circular Bin with Conical Hopper.py @@ -69,5 +69,11 @@ model.analyze() # Render the model. Labels and loads will be turned off to speed up interaction. -from PyNite.Visualization import Renderer, render_model -render_model(model, 0.1, render_loads=True, color_map='dz', combo_name='1.4F', labels=False) \ No newline at end of file +from PyNite.Visualization import Renderer +rndr = Renderer(model) +rndr.annotation_size = 0.1 +rndr.render_loads = False +rndr.color_map = 'dz' +rndr.combo_name = '1.4F' +rndr.labels = False +rndr.render_model() diff --git a/Examples/Moment Frame - Lateral Load.py b/Examples/Moment Frame - Lateral Load.py index 297a1c4..10b58da 100644 --- a/Examples/Moment Frame - Lateral Load.py +++ b/Examples/Moment Frame - Lateral Load.py @@ -71,8 +71,13 @@ # MomentFrame.analyze_linear(log=True) # Display the deformed shape of the structure magnified 50 times with the text height 5 model units (inches) high -from PyNite import Visualization -Visualization.render_model(MomentFrame, annotation_size=5, deformed_shape=True, deformed_scale=50, combo_name='1.2D+1.0W') +from PyNite.Visualization import Renderer +rndr = Renderer(MomentFrame) +rndr.annotation_size = 5 +rndr.deformed_shape = True +rndr.deformed_scale = 50 +rndr.combo_name = '1.2D+1.0W' +rndr.render_model(MomentFrame) # Plot the moment diagram for the beam MomentFrame.members['Beam'].plot_moment('Mz', combo_name='1.2D+1.0W') diff --git a/Examples/Space Frame - Nodal Loads 2.py b/Examples/Space Frame - Nodal Loads 2.py index c1fd9fa..fc0dddd 100644 --- a/Examples/Space Frame - Nodal Loads 2.py +++ b/Examples/Space Frame - Nodal Loads 2.py @@ -5,7 +5,7 @@ # Import 'FEModel3D' and 'Visualization' from 'PyNite' from PyNite import FEModel3D -from PyNite import Visualization +from PyNite.Visualization import Renderer # Create a new model frame = FEModel3D() @@ -49,5 +49,11 @@ print('Calculated results: ', frame.nodes['N2'].DY, frame.nodes['N3'].DZ) print('Expected results: ', -0.063, 1.825) -# Render the model for viewing -Visualization.render_model(frame, annotation_size=5, deformed_shape=True, deformed_scale=40, render_loads=True) \ No newline at end of file +# Render the deformed shape +rndr = Renderer(frame) +rndr.annotation_size = 5 +rndr.render_loads = True +rndr.deformed_shape = True +rndr.deformed_scale = 40 +rndr.render_loads = True +rndr.render_model() \ No newline at end of file From a35b5911a5dfa6f4b296d9a873b0e88bc05d89ce Mon Sep 17 00:00:00 2001 From: MPCBBishop Date: Fri, 6 Dec 2024 19:36:38 +0800 Subject: [PATCH 3/3] Fix FEModel3D and Renderer attr in Examples 1. `FEModel3D` does not have attr like `Quads` or `Meshes`, change it to `quads` and `meshes`, respectively. 2. `Renderer` does not have attr `labels`, change it to `show_labels`. --- Examples/Rectangular Tank Wall - Hydrostatic Loads.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Examples/Rectangular Tank Wall - Hydrostatic Loads.py b/Examples/Rectangular Tank Wall - Hydrostatic Loads.py index ca02664..09c4712 100644 --- a/Examples/Rectangular Tank Wall - Hydrostatic Loads.py +++ b/Examples/Rectangular Tank Wall - Hydrostatic Loads.py @@ -74,7 +74,7 @@ renderer.deformed_scale = 1000 renderer.color_map = 'Qy' renderer.combo_name = '1.4F' -renderer.labels = True +renderer.show_labels = True renderer.scalar_bar = True renderer.scalar_bar_text_size = 12 renderer.render_model() @@ -89,10 +89,10 @@ My = -0.0242*qo*a**2 # Pynite solution -Qx_pn = model.Quads['Q176'].shear(-1, 0, True, '1.4F')[0, 0] -Qy_pn = model.Meshes['MSH1'].max_shear('Qy', '1.4F') -Mx_pn = model.Quads['Q176'].moment(-1, 0, True, '1.4F')[0, 0] -My_pn = model.Meshes['MSH1'].min_moment('My', '1.4F') +Qx_pn = model.quads['Q176'].shear(-1, 0, True, '1.4F')[0, 0] +Qy_pn = model.meshes['MSH1'].max_shear('Qy', '1.4F') +Mx_pn = model.quads['Q176'].moment(-1, 0, True, '1.4F')[0, 0] +My_pn = model.meshes['MSH1'].min_moment('My', '1.4F') # Comparison of solutions print('Max Moment at Side Mid-Height of Wall, Mx | Pynite: ', Mx_pn, '| Timoshenko: ', Mx)