55second moment of area, and also orientation of the cross section profile.
66"""
77
8+ from math import pi
9+ import numpy
10+
811
912def truss_section (name , E = 0.0 , A = 0.0 , rho = 0.0 ):
1013 """
@@ -46,7 +49,7 @@ def beam_3d_section(
4649 Iz = 0.0 ,
4750 J = 0.0 ,
4851 rho = 0.0 ,
49- xz_vector = [ 0 , 0 , 1 ] ,
52+ xz_vector = ( 0 , 0 , 1 ) ,
5053):
5154 """
5255 Define 3d beam section.
@@ -71,3 +74,49 @@ def beam_3d_section(
7174 s ["J" ] = J
7275 s ["xz_vector" ] = xz_vector
7376 return s
77+
78+
79+ def close_points (points ):
80+ """
81+ If the input points do not form a closed polygon, closes the polygon
82+ and returns the result.
83+
84+ Parameters
85+ ----------
86+ points : array
87+ An array of (x, y) coordinates of shape (N, 2).
88+ """
89+ p = numpy .asarray (points )
90+ if (p [0 ] == p [- 1 ]).all ():
91+ return p
92+ return numpy .append (p , [p [0 ]], axis = 0 )
93+
94+
95+ def hollow_circle (innerradius , outerradius ):
96+ """
97+ Returns the area, moments of inertia and torsion constant for a hollow circle (tube).
98+ """
99+ Rext = outerradius
100+ Rint = innerradius
101+ A = pi * (Rext ^ 2 - Rint ^ 2 )
102+ Iy = pi / 4 * (Rext ^ 4 - Rint ^ 4 )
103+ Iz = pi / 4 * (Rext ^ 4 - Rint ^ 4 )
104+ Ix = Iy + Iz
105+ J = pi / 2 * (Rext ^ 4 - Rint ^ 4 )
106+ return A , Ix , Iy , Iz , J
107+
108+
109+ def i_beam (H , B , tf , tw ):
110+ """
111+ Returns the area, moments of inertia and torsion constant for an I-beam.
112+ """
113+ A = B * H - (B - tw ) * (H - 2 * tf )
114+ Iy = (B / 12 ) * H ** 3 - ((B - tw ) / 12 ) * (H - 2 * tf ) ** 3
115+ Iz = (
116+ H * B ** 3 / 12
117+ - 2 * ((B - tw ) / 2 ) ** 3 * (H - 2 * tf ) / 12
118+ - 2 * ((B - tw ) / 2 ) * (H - 2 * tf ) * ((B - tw ) / 4 + tw / 2 ) ** 2
119+ )
120+ Ix = Iy + Iz
121+ J = (2 * B * tf ** 3 + (H - 2 * tf ) * tw ** 3 ) / 3
122+ return A , Ix , Iy , Iz , J
0 commit comments