Ejemplo n.º 1
0
def graph(mode):
    tools.GRAPH_LATEX
    fig, ax = plt.subplots(figsize=mode)
    plt.subplots_adjust(left=0.12, bottom=0.12, right=0.9, top=0.88, wspace=0, hspace=0)


    ax.plot(l, y1, label="Hauteur H plaquette {} mm".format(h))
    ax.plot(l, y2, label="Largeur L plaquette {} mm".format(b))
    ax.set(xlabel="Longueur E plaquette (mm)", ylabel='Flexion (pour une force de {} N) (mm)'.format(F1),
           title='Comparaison flexion: hauteur - largeur plaquette {} x {} mm'.format(h, b))
    plt.grid()

    # Draw a default vline at x=... that spans the yrange
    color = 'tab:orange'
    plt.axvline(x=llimite, color=color)
    ax.annotate(
        'Limite de rigidité de $1 \cdot 10^{} N/m$.\n'
        'Longueur sortie de la plaquette {} mm. '.format(expok, llimite),
        (pos_x(llimite), ((max(y2) - min(y2))/7)*3.5), textcoords='data', color=color, bbox=tools.boite)

    plt.legend(loc='best')
    if SAVE==True:
        tools.save_auto(name_file)

    plt.show()
Ejemplo n.º 2
0
def plot_result_working_area(result_wa, a ,l1 ,l2 ,_name_file ,mode=tools.PORTRAIT):
    size = 10
    tools.GRAPH_LATEX
    fig, ax = plt.subplots(figsize=mode)
    plt.subplots_adjust(left=0.07, bottom=0.1, right=0.9, top=0.88, wspace=0, hspace=0)
    compteur_pt_ok = 0

    for signeX in [-1, 1]:
        for signeY in [-1, 1]:
            for res in result_wa:
                state = get_state_from_r1_r2(res[2], res[3])
                if state[1] is COLOR[-1][1]:
                    compteur_pt_ok += 1
                plt.scatter(signeX*res[0], signeY*res[1], c=state[0], s=size, marker= state[2])

    ax.set(title='Angle des rails de {}°, {} pts couverts / L1={}, L2={}'.format(a, compteur_pt_ok, l1, l2))
    plt.axis('equal')
    plt.gca().set_xlim(-40, 40)

    if SAVE==True:
        tools.save_auto(_name_file)
        # plt.show()
        plt.close()
    else:
        plt.show()
Ejemplo n.º 3
0
def graph(mode=tools.PORTRAIT):
    tools.GRAPH_LATEX
    fig, ax = plt.subplots(figsize=mode)
    plt.subplots_adjust(left=0.14, bottom=0.13, right=0.95)

    ax.plot(lbarre, k1, label="Ø {} mm".format(dfraise1))
    ax.plot(lbarre, k2, label="Ø {} mm".format(dfraise2))
    ax.plot(lbarre, k3, label="Ø {} mm".format(dfraise3))
    ax.set(xlabel="Longueur sortie outil (mm)",
           ylabel='Rigidité (N/m)',
           title='Rigidité outils axiaux fonction de la longueur de sortie')
    plt.ylim(klimite - 3000000, klimite + 10000000)
    plt.xlim(0, 10)

    plt.grid()
    color = 'tab:red'
    plt.axhline(y=klimite, color=color)
    ax.annotate('Limite longueur: \n{} mm\n{} mm\n{} mm'.format(
        round(llimitefraise1, 2), round(llimitefraise2, 2),
        round(llimitefraise3, 2)), (0.5, klimite * 1.6),
                textcoords='data',
                bbox=tools.boite)

    plt.legend(loc='best')
    if SAVE == True:
        tools.save_auto(name_file)

    plt.show()
Ejemplo n.º 4
0
def graph_avance_filetage(FZ, N, F, fzlimit, mode=tools.PORTRAIT):

    tools.GRAPH_LATEX
    fig, ax = plt.subplots(figsize=mode)
    plt.subplots_adjust(bottom=0.12)

    for ix, n_ix in enumerate(N):
        ax.plot(FZ,
                F[ix],
                label="Vitesse de rotation de {} tr/min      ".format(n_ix))

    ax.set(xlabel="Pas de filetage (mm)",
           ylabel='Avance de l\'axe Z (mm/min)',
           title='Vitesse d\'avance de l\'axe Z fonction du pas de filetage')
    plt.xticks(np.arange(0, max(FZ) + 0.1, 0.1))
    plt.gca().set_ylim(0, fzlimit + 5000)
    plt.grid()

    # Draw a default vline at x=... that spans the yrange
    color = 'tab:brown'
    plt.axhline(y=fzlimit, color=color)
    ax.annotate('Limite d\'avance de l\'axe Z {} (mm/min)'.format(fzlimit),
                (0, fzlimit + 2500),
                textcoords='data',
                color=color,
                bbox=tools.boite,
                ha='left')

    plt.legend(loc='best')

    if SAVE == True:
        tools.save_auto(name_file)

    plt.show()
def graph(mode):
    tools.GRAPH_LATEX
    fig, ax = plt.subplots(figsize=mode)
    plt.subplots_adjust()

    colorbarre = 'tab:orange'
    colorfraise = 'tab:blue'

    ax.plot(lbarre,
            kbarre,
            label="Rigidité barre acier diamètre {} mm".format(dbarre),
            color=colorbarre)
    ax.plot(lfraise,
            kfraise,
            label="Rigidité fraise métal dur diamètre {} mm".format(dfraise),
            color=colorfraise)
    plt.ylim(ymax=klimit * 2,
             ymin=klimit / 5)  # adjust the top leaving bottom unchanged
    ax.set(
        xlabel="Longueur sortie barre/fraise (mm)",
        ylabel='Rigidité (N/m)',
        title='Rigidité limite de ${} \cdot 10^{}$ N/m barre - fraise'.format(
            valk, expok))
    plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0))
    plt.grid()

    #Point intersection
    ax.plot(llimitefraise, klimit, "or", color=colorfraise)
    ax.plot(llimitebarre, klimit, "or", color=colorbarre)

    # Draw a default vline at x=... that spans the yrange
    color = 'tab:red'
    plt.axhline(y=klimit, color=color)
    ax.annotate('Limite longueur fraise {} mm.'.format(round(llimitefraise,
                                                             2)),
                (2, klimit * 1.2),
                textcoords='data',
                color=colorfraise)
    ax.annotate('Limite longueur barre {} mm.'.format(round(llimitebarre, 2)),
                (2, klimit * 1.4),
                textcoords='data',
                color=colorbarre)

    plt.legend(loc='best')
    if SAVE == True:
        tools.save_auto(name_file)

    plt.show()
Ejemplo n.º 6
0
def graph(mode=tools.PORTRAIT):
    tools.GRAPH_LATEX
    fig = plt.figure(figsize=mode)
    plt.subplots_adjust(left=0,
                        bottom=0,
                        right=0.93,
                        top=0.96,
                        wspace=0,
                        hspace=0)
    #ax = fig.add_subplot(111, projection="3d")
    ax = fig.gca(projection="3d")
    ax.set(xlabel="Longueur rail L1 (mm)",
           ylabel="Longueur rail L2 (mm)",
           zlabel="Surface couverte (points)",
           title='Zone de travail')

    ax.plot_trisurf(ListeL1, ListeL2, ListeSurface30, alpha=0.5)
    ax.plot_trisurf(ListeL1, ListeL2, ListeSurface45, alpha=0.5)
    ax.plot_trisurf(ListeL1, ListeL2, ListeSurface60, alpha=0.5)
    # ax.plot(X, Y, rigiX)
    # ax.plot(X, Y, rigiY)
    # ax.plot(X, Y, rigiZ, c="g")
    # ax.text2D(0.05, 0.95, "Rapport rigidité max/min: \n X {} \n Y {} \n Z {} \n Total {} ".format(rappX, rappY, rappZ, rappmax), transform=ax.transAxes)

    fake2Dline30 = mpl.lines.Line2D([0], [0],
                                    linestyle="none",
                                    c='tab:blue',
                                    marker='o')
    fake2Dline45 = mpl.lines.Line2D([0], [0],
                                    linestyle="none",
                                    c='tab:orange',
                                    marker='o')
    fake2Dline60 = mpl.lines.Line2D([0], [0],
                                    linestyle="none",
                                    c='tab:green',
                                    marker='o')
    ax.legend([fake2Dline30, fake2Dline45, fake2Dline60],
              ['Angle de 30°', 'Angle de 45°', 'Angle de 60°'],
              numpoints=1,
              loc='upper left')

    # anotation

    if SAVE == True:
        tools.save_auto(name_file)

    plt.show()
Ejemplo n.º 7
0
def graphcumuler(mode, _result1, _result2, _result3, _matiere_name):
    tools.GRAPH_LATEX
    fig, ax = plt.subplots(figsize=mode)
    # plt.subplots_adjust(left=0.1, bottom=0.12, right=0.97, top=0.88, wspace=0, hspace=0)

    colordentiste = 'tab:green'
    colormeyratmhf = 'tab:blue'
    colormeyratangle = 'tab:red'

    ax.plot(_result2[0][0],
            _result2[0][1],
            label="Broche dentaire",
            color=colordentiste)
    ax.plot(_result2[1][0], _result2[1][1], color=colordentiste)

    ax.plot(_result3[0][0],
            _result3[0][1],
            label="Broche Meyrat MHF 20",
            color=colormeyratmhf)
    ax.plot(_result3[1][0], _result3[1][1], color=colormeyratmhf)

    ax.plot(_result1[0][0],
            _result1[0][1],
            label="Broche Meyrat renvoi angle",
            color=colormeyratangle)
    ax.plot(_result1[1][0], _result1[1][1], color=colormeyratangle)

    plt.xlim(0.1, 7 + 0.1)  # adjust the top leaving bottom unchanged
    plt.ylim(0e5, 2.9e7)
    ax.set(xlabel="Diamètre barre (mm)",
           ylabel='Rigidité (N/m)',
           title='Comparaison diverses broches {}'.format(_matiere_name))
    plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0))
    plt.grid()

    plt.legend(loc='best')
    if SAVE == True:
        tools.save_auto(name_file_cumuler)
        # plt.show()
        plt.close()
    else:
        plt.show()
Ejemplo n.º 8
0
def graph(_result60, _result45, _result30, _l1, mode=tools.PORTRAIT):

    tools.GRAPH_LATEX
    fig, ax = plt.subplots(figsize=mode)
    plt.subplots_adjust(bottom=0.12)

    pente60 = round((_result60[0][3] - _result60[0][2]) / (_l1[3] - _l1[2]), 1)
    pente45 = round((_result45[0][3] - _result45[0][2]) / (_l1[3] - _l1[2]), 1)
    pente30 = round((_result30[0][3] - _result30[0][2]) / (_l1[3] - _l1[2]), 1)

    ax.plot(_l1,
            _result30[0],
            label="Angle des rails de 30° pente de {}".format(pente30))
    ax.plot(_l1,
            _result45[0],
            label="Angle des rails de 45° pente de {}".format(pente45))
    ax.plot(_l1,
            result60[0],
            label="Angle des rails de 60° pente de {}".format(pente60))

    ax.set(xlabel="Demi course rail L1 et L2 (mm)",
           ylabel='Périmètre de la zone de travail (mm)',
           title='Evolution périmètre fonction de la course')
    # plt.xticks(np.arange(0, max(FZ)+0.1, 0.1))
    # plt.gca().set_xlim(0, 40)
    # plt.gca().set_ylim(0, 350)
    plt.grid()
    #
    # # Draw a default vline at x=... that spans the yrange

    # color = 'tab:brown'
    # plt.axhline(y=fzlimit, color=color)
    # ax.annotate( '{} (mm/min)'.format(fzlimit), (0, fzlimit + 2500), textcoords='data', color=color, bbox=dict(boxstyle="round", fc="w"))

    plt.legend(loc='best')

    if SAVE == True:
        tools.save_auto(name_file)

    plt.show()
def graph(f,mode):
    tools.GRAPH_LATEX
    fig = plt.figure(figsize=mode)
    plt.subplots_adjust(left=-0.02, bottom=0, right=1, top=0.88, wspace=0, hspace=0)
    #ax = fig.add_subplot(111, projection="3d")
    ax= fig.gca(projection="3d")
    ax.set(xlabel="Position sur l'axe X (mm)", ylabel="Position sur l'axe Y (mm)", zlabel="Rigidité (N/m)",
           title='Espace de rigidité')

    # ax.ticklabel_format(axis='z', style='scientific', scilimits=(-1, 2))
    if f>2e7 :
        ax.scatter(X, Y, rigiX, label="Direction X", marker='^', alpha=1)
        ax.scatter(X, Y, rigiY, label="Direction Y", marker='+', alpha=1)
        ax.scatter(X, Y, rigiZ, label="Direction Z", marker='o', alpha=1, c="g")
        ax.plot(X, Y, rigiX)
        ax.plot(X, Y, rigiY)
        ax.plot(X, Y, rigiZ, c="g")
        ax.text2D(0.1, 0.8, "Rigidité max: {} N/m en X \nRigidité min: {} N/m en Z\nRapport rigidité max/min: \nX {} \nY {} \nZ {} \nTotal {}".format(maxmax,minmin,rappX, rappY, rappZ, rappmax), transform=ax.transAxes)
    else:
        ax.scatter(X, Y, rigiZ, label="Direction Z", marker='o', alpha=1, c="g")
        ax.plot(X, Y, rigiZ, c="g")
        ax.text2D(0.1, 0.8, "Rigidité max {} N/m \nRigidité min {} N/m \nRapport rigidité max/min: \nZ {}".format(zmax,zmin,rappZ), transform=ax.transAxes)

    # plt.gca().set_zlim(0, f)

    # anotation
    ax.text(-10, -10, 0, "Zone de travail", color='k')

    # cercle de la course course
    plt.plot(courseX, courseY, c="k", marker='.', linestyle=':')

    plt.legend(loc='best')

    if SAVE==True:
        tools.save_auto(name_file)

    plt.show()
Ejemplo n.º 10
0
def graphsimple(mode, _result, _pointinflex, _lfraise, _lbarre, _name_file,
                _matiere_name):
    rcParams['font.family'] = 'sans-serif'
    rcParams['font.sans-serif'] = ['DejaVu Sans']
    fig, ax = plt.subplots(figsize=mode)
    # plt.subplots_adjust(left=0.1, bottom=0.12, right=0.97, top=0.88, wspace=0, hspace=0)

    colorbarre = 'tab:orange'
    colorfraise = 'tab:blue'

    ax.plot(_result[0][0],
            _result[0][1],
            label="Longueur fraise {} mm.\nDistance canon {} mm.".format(
                _lfraise[0], _lbarre[0]),
            color=colorbarre)
    ax.plot(_result[1][0],
            _result[1][1],
            label="Longueur fraise {} mm.\nDistance canon {} mm.".format(
                _lfraise[1], _lbarre[1]),
            color=colorfraise)
    plt.xlim(0.1, 7 + 0.1)  # adjust the top leaving bottom unchanged
    plt.ylim(0e5, 2.9e7)
    ax.set(xlabel="Diamètre barre (mm)",
           ylabel='Rigidité (N/m)',
           title='Rigidité fraise vs barre {}'.format(_matiere_name))
    plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0))
    plt.grid()

    bbox = tools.boite
    arrowprops90 = dict(arrowstyle="->",
                        connectionstyle="angle,angleA=0,angleB=90,rad=10")
    arrowprops45 = dict(arrowstyle="->",
                        connectionstyle="angle,angleA=0,angleB=-60,rad=1")

    xbas = max(_result[0][0])
    ybas = max(_result[0][1])

    offset = 7
    ax.annotate('point changement :\n%.1f mm; %.1e N/m' % (xbas, ybas),
                (xbas, ybas),
                xytext=(-9 * offset, 8 * offset),
                textcoords='offset points',
                bbox=bbox,
                arrowprops=arrowprops90)

    xhaut = _pointinflex[0][0]
    yhaut = _pointinflex[1][0]
    offset = 3
    ax.annotate('point changement :\n%.1f mm; %.1e N/m' % (xhaut, yhaut),
                (xhaut, yhaut),
                xytext=(6 * offset, -20 * offset),
                textcoords='offset points',
                bbox=bbox,
                arrowprops=arrowprops45)

    #Point intersection
    # ax.plot(llimitefraise, klimit, "or", color=colorfraise)
    # ax.plot(llimitebarre, klimit, "or", color=colorbarre)

    # Draw a default vline at x=... that spans the yrange
    # color = 'tab:red'
    # plt.axhline(y=klimit, color=color)
    # ax.annotate('Limite longueur fraise {} mm.'
    #             .format(round(llimitefraise, 2)), (2, klimit*1.2), textcoords='data', color=colorfraise)
    # ax.annotate('Limite longueur barre {} mm.'
    #             .format(round(llimitebarre, 2)), (2, klimit * 1.4), textcoords='data', color=colorbarre)

    plt.legend(loc='best')
    if SAVE == True:
        tools.save_auto(_name_file)
        # plt.show()
        plt.close()
    else:
        plt.show()