Beispiel #1
0
def tut3D_step3_window(screen, prev_win, windows):
    global angle_check
    Big_font = game_font(60)
    Small_font = game_font(25)
    extra_small_font = game_font(18)
    mid_font = game_font(40)
    # print(sigma_xx_tut.text, sigma_yy_tut.text, tau_xy_tut.text, angle_tut.text)
    head_text = Big_font.render("Tutorial 3-D Mode", 1, (0, 0, 0))
    mid_text = mid_font.render("STEP-3", 1, (0, 0, 0))
    screen.blit(head_text, (80, 70))
    screen.blit(mid_text, (80, 150))
    m = tut_Stress_MohrCircle(σxx=float(sigma_xx_tut.text),
                              σyy=float(sigma_yy_tut.text),
                              σzz=float(sigma_zz_tut.text),
                              σxy=float(tau_xy_tut.text),
                              σyz=float(tau_yz_tut.text),
                              σzx=float(tau_zx_tut.text))
    m.ndims = 3
    Is = m.get_I_values()
    tut_text = [
        "Now, using the center and radius being ",
        "Therefore, the corresponding values are : ",
        "I1 = " + str(round(Is[0], 3)),
        "I2 = " + str(round(Is[1], 3)),
        "I3 = " + str(round(Is[2], 3)),
    ]
    eqn_text = [
        "The next step would be to calculate the",
        "values of lamb from previous slide.",
        "our equation becomes : ",
        "lamb^3 - (" + str(round(Is[0], 3)) + ")*lamb^2 + " +
        str(round(Is[1], 3)) + "*lamb -(" + str(round(Is[2], 3)) + ") = 0",
    ]
    count = 0
    for text in tut_text:
        text = Small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (70, 200 + count))
        count += 40
    count = 0
    for text in eqn_text:
        text = extra_small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (70, 410 + count))
        count += 30
    backButton.draw(screen, (0, 0, 0))
    nextButton.draw(screen, (0, 0, 0))

    for event in pygame.event.get():
        pos = pygame.mouse.get_pos()
        if event.type == pygame.QUIT:
            global running
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if backButton.isOver(pos):
                tut3D_step2_window_check.makeCurrent()
                tut3D_step3_window_check.endCurrent()
            if nextButton.isOver(pos):
                tut3D_step3_window_check.endCurrent()
                tut3D_step4_window_check.makeCurrent()
Beispiel #2
0
def tut3D_step6_window(screen, prev_win, windows):
    global angle_check
    Big_font = game_font(60)
    Small_font = game_font(25)
    mid_font = game_font(40)
    # print(sigma_xx_tut.text, sigma_yy_tut.text, tau_xy_tut.text, angle_tut.text)
    head_text = Big_font.render("Tutorial 3-D Mode", 1, (0, 0, 0))
    mid_text = mid_font.render("STEP-6", 1, (0, 0, 0))
    screen.blit(head_text, (80, 70))
    screen.blit(mid_text, (80, 150))
    tut_text = [
        "Using the centers, and the corresponding ",
        "principle stresse, draw circles with radii",
        "being distance between the centers and their",
        "corresponding principle stresses.",
    ]
    count = 0
    for text in tut_text:
        text = Small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (70, 200 + count))
        count += 40
    backButton.draw(screen, (0, 0, 0))
    xButton = nextButton
    if angle_check == 0:
        xButton = finishButton
    xButton.draw(screen, (0, 0, 0))
    graphButton.draw(screen, (0, 0, 0))
    for event in pygame.event.get():
        pos = pygame.mouse.get_pos()
        if event.type == pygame.QUIT:
            global running
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if backButton.isOver(pos):
                tut3D_step5_window_check.makeCurrent()
                tut3D_step6_window_check.endCurrent()
            if xButton.isOver(pos):
                if xButton == nextButton:
                    tut3D_step7_window_check.makeCurrent()
                    tut3D_step6_window_check.endCurrent()
                else:
                    tut3D_final_window_check.makeCurrent()
                    tut3D_step6_window_check.endCurrent()
            if graphButton.isOver(pos):
                req_mohr = tut_Stress_MohrCircle(float(sigma_xx_tut.text),
                                                 float(sigma_yy_tut.text),
                                                 float(tau_xy_tut.text),
                                                 float(sigma_zz_tut.text),
                                                 float(tau_yz_tut.text),
                                                 float(tau_zx_tut.text))
                req_mohr.ndims = 3
                req_mohr.plot_circle_3d()
Beispiel #3
0
def tut3D_step4_window(screen, prev_win, windows):
    Big_font = game_font(60)
    Small_font = game_font(25)
    mid_font = game_font(40)
    # print(sigma_xx_tut.text, sigma_yy_tut.text, tau_xy_tut.text, angle_tut.text)
    head_text = Big_font.render("Tutorial 3-D Mode", 1, (0, 0, 0))
    mid_text = mid_font.render("STEP-4", 1, (0, 0, 0))
    screen.blit(head_text, (80, 70))
    screen.blit(mid_text, (80, 150))
    m = tut_Stress_MohrCircle(σxx=float(sigma_xx_tut.text),
                              σyy=float(sigma_yy_tut.text),
                              σzz=float(sigma_zz_tut.text),
                              σxy=float(tau_xy_tut.text),
                              σyz=float(tau_yz_tut.text),
                              σzx=float(tau_zx_tut.text))
    m.ndims = 3
    eigen = m.get_princip_values()
    prin_stress = np.sort(eigen)[::-1]
    tut_text = [
        "Now, using the center and radius being ",
        "Solving the equation gives us : ",
        "lamb = " + str(eigen[0]) + ", lamb = " + str(eigen[1]) + ", lamb = " +
        str(eigen[2]),
        " ",
        "Arrange the values such that sig_1",
        "is the largest and sig_3 is the least",
        "sig_1, sig_2, sig_3 are principle stresses",
        "sig_1 = " + str(prin_stress[0]) + ", sig_2 = " + str(prin_stress[1]) +
        ", sig_3 = " + str(prin_stress[2]),
    ]
    count = 0
    for text in tut_text:
        text = Small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (65, 200 + count))
        count += 40
    backButton.draw(screen, (0, 0, 0))
    nextButton.draw(screen, (0, 0, 0))
    for event in pygame.event.get():
        pos = pygame.mouse.get_pos()
        if event.type == pygame.QUIT:
            global running
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if backButton.isOver(pos):
                tut3D_step3_window_check.makeCurrent()
                tut3D_step4_window_check.endCurrent()
            if nextButton.isOver(pos):
                tut3D_step5_window_check.makeCurrent()
                tut3D_step4_window_check.endCurrent()
Beispiel #4
0
def tut2D_step4_window(screen, prev_win, windows):
    Big_font = game_font(60)
    Small_font = game_font(25)
    mid_font = game_font(40)
    # print(sigma_xx_tut.text, sigma_yy_tut.text, tau_xy_tut.text, angle_tut.text)
    head_text = Big_font.render("Tutorial 2-D Mode", 1, (0, 0, 0))
    mid_text = mid_font.render("STEP-4", 1, (0, 0, 0))
    screen.blit(head_text, (80, 70))
    screen.blit(mid_text, (80, 150))
    tut_text = [
        "Now, using the center and radius being ",
        "To find the values of stress at an angle",
        "say theta. Rotate the line about the center",
        "by an angle of 2*theta.", " ",
        "NOTE: the rotation should be in anticlockwise ",
        "direction with the angle is positive and",
        "clockwise if the angle is negative"
    ]
    count = 0
    for text in tut_text:
        text = Small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (70, 200 + count))
        count += 40
    backButton.draw(screen, (0, 0, 0))
    nextButton.draw(screen, (0, 0, 0))
    graphButton.draw(screen, (0, 0, 0))
    for event in pygame.event.get():
        pos = pygame.mouse.get_pos()
        if event.type == pygame.QUIT:
            global running
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if backButton.isOver(pos):
                tut2D_step3_window_check.makeCurrent()
                tut2D_step4_window_check.endCurrent()
            if nextButton.isOver(pos):
                tut2D_step5_window_check.makeCurrent()
                tut2D_step4_window_check.endCurrent()
            if graphButton.isOver(pos):
                req_mohr = tut_Stress_MohrCircle(float(sigma_xx_tut.text),
                                                 float(sigma_yy_tut.text),
                                                 float(tau_xy_tut.text))
                req_mohr.angle2d = float(angle_tut.text)
                req_mohr.ndims = 2
                req_mohr.plot_angle2d()
Beispiel #5
0
def tut3D_step5_window(screen, prev_win, windows):
    Big_font = game_font(60)
    Small_font = game_font(25)
    mid_font = game_font(40)
    # print(sigma_xx_tut.text, sigma_yy_tut.text, tau_xy_tut.text, angle_tut.text)
    head_text = Big_font.render("Tutorial 2-D Mode", 1, (0, 0, 0))
    mid_text = mid_font.render("STEP-5", 1, (0, 0, 0))
    screen.blit(head_text, (80, 70))
    screen.blit(mid_text, (80, 150))
    tut_text = [
        "Now, using the principle stresses, ",
        "Plot the stresses calculated on the X-axis",
        "Find the midpoint between each of the three",
        "points",
    ]
    count = 0
    for text in tut_text:
        text = Small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (70, 200 + count))
        count += 40
    backButton.draw(screen, (0, 0, 0))
    nextButton.draw(screen, (0, 0, 0))
    graphButton.draw(screen, (0, 0, 0))
    for event in pygame.event.get():
        pos = pygame.mouse.get_pos()
        if event.type == pygame.QUIT:
            global running
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if backButton.isOver(pos):
                tut3D_step4_window_check.makeCurrent()
                tut3D_step5_window_check.endCurrent()
            if nextButton.isOver(pos):
                tut3D_step6_window_check.makeCurrent()
                tut3D_step5_window_check.endCurrent()
            if graphButton.isOver(pos):
                req_mohr = tut_Stress_MohrCircle(float(sigma_xx_tut.text),
                                                 float(sigma_yy_tut.text),
                                                 float(tau_xy_tut.text),
                                                 float(sigma_zz_tut.text),
                                                 float(tau_yz_tut.text),
                                                 float(tau_zx_tut.text))
                req_mohr.ndims = 3
                req_mohr.plot_cent()
Beispiel #6
0
def tut2D_step2_window(screen, prev_win, windows):
    Big_font = game_font(60)
    Small_font = game_font(25)
    mid_font = game_font(40)
    # print(sigma_xx_tut.text, sigma_yy_tut.text, tau_xy_tut.text, angle_tut.text)
    head_text = Big_font.render("Tutorial 2-D Mode", 1, (0, 0, 0))
    mid_text = mid_font.render("STEP-2", 1, (0, 0, 0))
    screen.blit(head_text, (80, 70))
    screen.blit(mid_text, (80, 150))
    tut_text = [
        "The next step to draw a 2-d Mohr circle ",
        "for the given stress state is to draw",
        "is to join the points plotted using a ",
        "straight line. Mark the point where the ",
        "line intersects X-axis as the center of ",
        "the circle",
    ]
    count = 0
    for text in tut_text:
        text = Small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (70, 200 + count))
        count += 40
    backButton.draw(screen, (0, 0, 0))
    nextButton.draw(screen, (0, 0, 0))
    graphButton.draw(screen, (0, 0, 0))
    for event in pygame.event.get():
        pos = pygame.mouse.get_pos()
        if event.type == pygame.QUIT:
            global running
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if backButton.isOver(pos):
                tut2D_step1_window_check.makeCurrent()
                tut2D_step2_window_check.endCurrent()
            if nextButton.isOver(pos):
                tut2D_step2_window_check.endCurrent()
                tut2D_step3_window_check.makeCurrent()
            if graphButton.isOver(pos):
                req_mohr = tut_Stress_MohrCircle(float(sigma_xx_tut.text),
                                                 float(sigma_yy_tut.text),
                                                 float(tau_xy_tut.text))
                req_mohr.ndims = 2
                req_mohr.plot_cent()
Beispiel #7
0
def tut2D_step1_window(screen, prev_win, windows):
    Big_font = game_font(60)
    Small_font = game_font(25)
    mid_font = game_font(40)
    # print(sigma_xx_tut.text, sigma_yy_tut.text, tau_xy_tut.text, angle_tut.text)
    head_text = Big_font.render("Tutorial 2-D Mode", 1, (0, 0, 0))
    mid_text = mid_font.render("STEP-1", 1, (0, 0, 0))
    screen.blit(head_text, (80, 70))
    screen.blit(mid_text, (80, 150))
    tut_text = [
        "The first step to draw a 2-d Mohr circle ",
        "for the given stress state is to draw",
        "the points corresponding to the stresses", "On a graph, Plot: ",
        "(sigma_xx, -tau_xy) & (sigma_yy, tau_xy)"
    ]
    count = 0
    for text in tut_text:
        text = Small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (70, 200 + count))
        count += 40
    backButton.draw(screen, (0, 0, 0))
    nextButton.draw(screen, (0, 0, 0))
    graphButton.draw(screen, (0, 0, 0))
    for event in pygame.event.get():
        pos = pygame.mouse.get_pos()
        if event.type == pygame.QUIT:
            global running
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if backButton.isOver(pos):
                tut2D_stress_input_window_check.makeCurrent()
                tut2D_step1_window_check.endCurrent()
            if nextButton.isOver(pos):
                tut2D_step1_window_check.endCurrent()
                tut2D_step2_window_check.makeCurrent()
            if graphButton.isOver(pos):
                req_mohr = tut_Stress_MohrCircle(float(sigma_xx_tut.text),
                                                 float(sigma_yy_tut.text),
                                                 float(tau_xy_tut.text))
                req_mohr.ndims = 2
                req_mohr.plot_init_pts()
Beispiel #8
0
def tut2D_step3_window(screen, prev_win, windows):
    global angle_check
    global sigma1, sigma2, curr_angle
    Big_font = game_font(60)
    Small_font = game_font(25)
    extra_small_font = game_font(15)
    mid_font = game_font(40)
    # print(sigma_xx_tut.text, sigma_yy_tut.text, tau_xy_tut.text, angle_tut.text)
    head_text = Big_font.render("Tutorial 2-D Mode", 1, (0, 0, 0))
    mid_text = mid_font.render("STEP-3", 1, (0, 0, 0))
    screen.blit(head_text, (80, 70))
    screen.blit(mid_text, (80, 150))
    tut_text = [
        "Now, using the center and radius being ",
        "the distance between the center and one ",
        "of the plotted points, draw a circle.",
        "Thus you get your Mohr's Circle",
        "The points where the circle cuts the X-axis",
        "are the principal stresses."
    ]
    count = 0
    for text in tut_text:
        text = Small_font.render(text, 1, (0, 0, 0))
        screen.blit(text, (70, 200 + count))
        count += 40
    backButton.draw(screen, (0, 0, 0))
    xButton = nextButton
    if angle_check == 0:
        xButton = finishButton
    xButton.draw(screen, (0, 0, 0))
    graphButton.draw(screen, (0, 0, 0))

    try:
        mohr_2d = Stress_MohrCircle(σxx=float(sigma_xx_tut.text),
                                    σyy=float(sigma_yy_tut.text),
                                    σzz=0,
                                    σxy=float(tau_xy_tut.text),
                                    σyz=0,
                                    σzx=0)
        mohr_2d.ndims = 2
        mohr_2d.isGraph = False
        if (angle_gen.text != ''):
            mohr_2d.isAngle_stress = True
            mohr_2d.reqAngle_stress_2d = float(angle_gen.text)
        _, sig, _, _, _, curr_angle = mohr_2d.stress_execute()
        sigma1, sigma2 = sig[0][0], sig[1][0]

        curr_angle = round(np.rad2deg(curr_angle), 2)
        answer_txt = "sigma_1 : " + str(sigma1) + ", sigma_2 : " + str(
            sigma2) + ", phi : " + str(curr_angle) + " deg"
        answer_txt = extra_small_font.render(answer_txt, 1, (0, 0, 0))
        screen.blit(answer_txt, (50, 480))
    except ValueError:
        # print(e)
        answer_txt = "sigma_1 :   sigma_2 :   phi"
        answer_txt = extra_small_font.render(answer_txt, 1, (0, 0, 0))
        screen.blit(answer_txt, (50, 480))
    for event in pygame.event.get():
        pos = pygame.mouse.get_pos()
        if event.type == pygame.QUIT:
            global running
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            if backButton.isOver(pos):
                tut2D_step2_window_check.makeCurrent()
                tut2D_step3_window_check.endCurrent()
            if xButton.isOver(pos):
                if xButton == nextButton:
                    tut2D_step3_window_check.endCurrent()
                    tut2D_step4_window_check.makeCurrent()
                else:
                    tut2D_step3_window_check.endCurrent()
                    tut2D_final_window_check.makeCurrent()
            if graphButton.isOver(pos):
                req_mohr = tut_Stress_MohrCircle(float(sigma_xx_tut.text),
                                                 float(sigma_yy_tut.text),
                                                 float(tau_xy_tut.text))
                req_mohr.ndims = 2
                req_mohr.plot_circle()