CuboctSTL_v0.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:CuboctSTL 作者: figlax 项目源码 文件源码
def pitch_from_relden(relden, cf, sw):
    """
    This function calculates the pitch of cuboct of a given relative density, chamfer factor, and strut width.
    :param relden: float. Desired relative density
    :param cf: float. Chamfer factor of voxel
    :param sw: float. strut width of voxel
    :return: lattice pitch
    """
    chamheight = float(sw) / cf
    l_2 = sw / 2.0 + chamheight
    l_3 = l_2 + sw * np.cos(math.radians(45))  # horizontal position of points
    l_4 = np.sqrt(2) * (l_3 - sw / 2.0)
    tan_theta = ((l_3 - l_2) / ((l_4 / 2.0) - (np.sqrt(2) * chamheight / 2.0)))
    v1 = l_2 * (sw * sw + 4 * sw * (l_3 - sw / 2.0) + 2 * (l_3 - sw / 2.0) * (l_3 - sw / 2.0))
    h = (l_4 / 2.0) * tan_theta
    hs = chamheight * tan_theta * np.sqrt(2) / 2.0
    v2 = ((l_4 * l_4 * h) - (2 * (chamheight * chamheight * hs))) / 3.0
    v3 = 4 * sw * (0.5 * (l_3 - l_2) * (l_3 - l_2) + (l_3 - l_2) * chamheight)
    v4 = sw * sw * (l_3 - l_2)
    node_volume = v1 + v2 + v3 + v4

    c1 = relden
    c2 = (-6) * np.sqrt(2)*sw *sw
    c3 = -6*node_volume + 12*sw*sw*np.sqrt(2)*(l_2 + l_3)
    return max(np.roots([c1, 0, c2, c3]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号