Пример #1
0
def get_properties():

    # build the lists of points, facets, holes and control points
    points = request.json['points']
    facets = request.json['facets']
    holes = request.json['holes']
    control_points = request.json['controls']

    # create the custom geometry object
    geometry = sections.CustomSection(points, facets, holes, control_points)
    geometry.clean_geometry()  # clean the geometry

    # create the mesh - use a smaller refinement for the angle region
    mesh = geometry.create_mesh(mesh_sizes=[0.0005, 0.001])

    # create a CrossSection object
    section = CrossSection(geometry, mesh)

    # perform a geometric, warping and plastic analysis
    section.calculate_geometric_properties()
    section.calculate_warping_properties()
    section.calculate_plastic_properties()

    properties = section.display_results()

    return jsonify({'properties': properties})
mesh = geometry.create_mesh(mesh_sizes=[5, 20])

# create a CrossSection object - take care to list the materials in the same order as entered into
# the MergedSection
section = CrossSection(geometry, mesh, materials=[steel, timber])
section.display_mesh_info()  # display the mesh information

# plot the mesh with coloured materials and a line transparency of 0.5
section.plot_mesh(materials=True, alpha=0.5)

# perform a geometric, warping and plastic analysis
section.calculate_geometric_properties(time_info=True)
section.calculate_warping_properties(time_info=True)
section.calculate_plastic_properties(time_info=True, verbose=True)

# perform a stress analysis with N = 100 kN, Mxx = 120 kN.m and Vy = 75 kN
stress_post = section.calculate_stress(N=-100e3,
                                       Mxx=-120e6,
                                       Vy=-75e3,
                                       time_info=True)

# print the results to the terminal
section.display_results()

# plot the centroids
section.plot_centroids()

stress_post.plot_stress_n_zz(pause=False)  # plot the axial stress
stress_post.plot_stress_m_zz(pause=False)  # plot the bending stress
stress_post.plot_stress_v_zxy()  # plot the shear stress