Skip to content

Commit cbced09

Browse files
authored
Merge pull request #229 from guyi2000/examples-fix
Fix several bugs in Examples
2 parents 9a3d905 + a35b591 commit cbced09

5 files changed

+38
-21
lines changed

Examples/Braced Frame - Tension Only.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@
7676
# to the full member length. Note also that the direction uses lowercase
7777
# notations to indicate member local coordinate systems. Brace loads have been
7878
# neglected.
79-
braced_frame.add_member_dist_load('Beam', Direction='Fy', w1=-0.024/12,
79+
braced_frame.add_member_dist_load('Beam', direction='Fy', w1=-0.024/12,
8080
w2=-0.024/12, x1=0, x2=15*12, case='D')
81-
braced_frame.add_member_dist_load('Col1', Direction='Fx', w1=-0.033/12,
81+
braced_frame.add_member_dist_load('Col1', direction='Fx', w1=-0.033/12,
8282
w2=-0.033/12, x1=0, x2=12*12, case='D')
83-
braced_frame.add_member_dist_load('Col2', Direction='Fx', w1=-0.033/12,
83+
braced_frame.add_member_dist_load('Col2', direction='Fx', w1=-0.033/12,
8484
w2=-0.033/12, x1=0, x2=12*12, case='D')
8585

8686
# Add nodal wind loads of 25 kips to each side of the frame. Note that the
8787
# direction uses uppercase notation to indicate model global coordinate
8888
# system.
89-
braced_frame.add_node_load('N2', Direction='FX', P=25, case='W')
90-
braced_frame.add_node_load('N3', Direction='FX', P=25, case='W')
89+
braced_frame.add_node_load('N2', direction='FX', P=25, case='W')
90+
braced_frame.add_node_load('N3', direction='FX', P=25, case='W')
9191

9292
# Create load combinations
9393
# Note that the load combination '1.4D' has no lateral load, but does have

Examples/Circular Bin with Conical Hopper.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,11 @@
6969
model.analyze()
7070

7171
# Render the model. Labels and loads will be turned off to speed up interaction.
72-
from PyNite.Visualization import Renderer, render_model
73-
render_model(model, 0.1, render_loads=True, color_map='dz', combo_name='1.4F', labels=False)
72+
from PyNite.Visualization import Renderer
73+
rndr = Renderer(model)
74+
rndr.annotation_size = 0.1
75+
rndr.render_loads = False
76+
rndr.color_map = 'dz'
77+
rndr.combo_name = '1.4F'
78+
rndr.labels = False
79+
rndr.render_model()

Examples/Moment Frame - Lateral Load.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
# Add self weight dead loads to the frame
4949
# Note that we could leave 'x1' and 'x2' undefined below and it would default to the full member length
5050
# Note also that the direction uses lowercase notations to indicate member local coordinate systems
51-
MomentFrame.add_member_dist_load('Beam', Direction='Fy', w1=-0.024/12, w2=-0.024/12, x1=0, x2=15*12, case='D')
52-
MomentFrame.add_member_dist_load('Col1', Direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D')
53-
MomentFrame.add_member_dist_load('Col2', Direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D')
51+
MomentFrame.add_member_dist_load('Beam', direction='Fy', w1=-0.024/12, w2=-0.024/12, x1=0, x2=15*12, case='D')
52+
MomentFrame.add_member_dist_load('Col1', direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D')
53+
MomentFrame.add_member_dist_load('Col2', direction='Fx', w1=-0.033/12, w2=-0.033/12, x1=0, x2=12*12, case='D')
5454

5555
# Add a nodal wind load of 10 kips at the left side of the frame
5656
# Note that the direction uses uppercase notation to indicate model global coordinate system
57-
MomentFrame.add_node_load('N2', Direction='FX', P=10, case='W')
57+
MomentFrame.add_node_load('N2', direction='FX', P=10, case='W')
5858

5959
# Create two load combinations
6060
MomentFrame.add_load_combo('1.2D+1.0W', factors={'D':1.2, 'W':1.0})
@@ -71,8 +71,13 @@
7171
# MomentFrame.analyze_linear(log=True)
7272

7373
# Display the deformed shape of the structure magnified 50 times with the text height 5 model units (inches) high
74-
from PyNite import Visualization
75-
Visualization.render_model(MomentFrame, annotation_size=5, deformed_shape=True, deformed_scale=50, combo_name='1.2D+1.0W')
74+
from PyNite.Visualization import Renderer
75+
rndr = Renderer(MomentFrame)
76+
rndr.annotation_size = 5
77+
rndr.deformed_shape = True
78+
rndr.deformed_scale = 50
79+
rndr.combo_name = '1.2D+1.0W'
80+
rndr.render_model(MomentFrame)
7681

7782
# Plot the moment diagram for the beam
7883
MomentFrame.members['Beam'].plot_moment('Mz', combo_name='1.2D+1.0W')

Examples/Rectangular Tank Wall - Hydrostatic Loads.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
renderer.deformed_scale = 1000
7575
renderer.color_map = 'Qy'
7676
renderer.combo_name = '1.4F'
77-
renderer.labels = True
77+
renderer.show_labels = True
7878
renderer.scalar_bar = True
7979
renderer.scalar_bar_text_size = 12
8080
renderer.render_model()
@@ -89,10 +89,10 @@
8989
My = -0.0242*qo*a**2
9090

9191
# Pynite solution
92-
Qx_pn = model.Quads['Q176'].shear(-1, 0, True, '1.4F')[0, 0]
93-
Qy_pn = model.Meshes['MSH1'].max_shear('Qy', '1.4F')
94-
Mx_pn = model.Quads['Q176'].moment(-1, 0, True, '1.4F')[0, 0]
95-
My_pn = model.Meshes['MSH1'].min_moment('My', '1.4F')
92+
Qx_pn = model.quads['Q176'].shear(-1, 0, True, '1.4F')[0, 0]
93+
Qy_pn = model.meshes['MSH1'].max_shear('Qy', '1.4F')
94+
Mx_pn = model.quads['Q176'].moment(-1, 0, True, '1.4F')[0, 0]
95+
My_pn = model.meshes['MSH1'].min_moment('My', '1.4F')
9696

9797
# Comparison of solutions
9898
print('Max Moment at Side Mid-Height of Wall, Mx | Pynite: ', Mx_pn, '| Timoshenko: ', Mx)

Examples/Space Frame - Nodal Loads 2.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Import 'FEModel3D' and 'Visualization' from 'PyNite'
77
from PyNite import FEModel3D
8-
from PyNite import Visualization
8+
from PyNite.Visualization import Renderer
99

1010
# Create a new model
1111
frame = FEModel3D()
@@ -49,5 +49,11 @@
4949
print('Calculated results: ', frame.nodes['N2'].DY, frame.nodes['N3'].DZ)
5050
print('Expected results: ', -0.063, 1.825)
5151

52-
# Render the model for viewing
53-
Visualization.render_model(frame, annotation_size=5, deformed_shape=True, deformed_scale=40, render_loads=True)
52+
# Render the deformed shape
53+
rndr = Renderer(frame)
54+
rndr.annotation_size = 5
55+
rndr.render_loads = True
56+
rndr.deformed_shape = True
57+
rndr.deformed_scale = 40
58+
rndr.render_loads = True
59+
rndr.render_model()

0 commit comments

Comments
 (0)