コード例 #1
0
        0,
        ratio=[1, 0.9, 1],
        translate=[0, 11, 0],
        angle=0)

    data_6d = calligraphy_tool.transform_6d(data_6d,
                                            z0_point,
                                            anchor=0,
                                            ratio=[1, 1, 0.6],
                                            translate=[0, 0, -3],
                                            angle=0)

    data_6d = calligraphy_tool.transform_to_rect_6d(data_6d,
                                                    [-122, -65.5, 405, 443.5],
                                                    z0_point,
                                                    ratio_z=0,
                                                    translate_z=0,
                                                    center=True,
                                                    deform=False)

    calligraphy_tool.visualize_line_6d(data_6d,
                                       data_cmd,
                                       z0_point,
                                       with_thickness=True,
                                       plot=False)

    data_6dcmd = calligraphy_tool.six_to_cmd(data_6d, data_cmd)
    save_file(output_path, data_6dcmd)

    plt.gca().set_aspect("equal")
    plt.show()
コード例 #2
0
                 [startx + total_width, starty]])

calligraphy_tool = calligraphy_transform()
water_6d, water_cmd = calligraphy_tool.read_file(water_path, is_6dcmd=True)
out_6dcmd = calligraphy_tool.six_to_cmd(water_6d, water_cmd)
sample_6d = np.array([[
    -169.6492231584243, 425.04838061558877, 166.73827137352038, -158.4866,
    -2.4102, 44.4074
]])
sample_cmd = np.array([['movl', 0, 100.0000, 'stroke0']])
sample_3d, sample_angle = calligraphy_tool.six_to_three(sample_6d)

for i in range(len(axis) + 1):
    for j in range(2):
        sample_3d[0][0] = axis[i % 4][0]
        sample_3d[0][1] = axis[i % 4][1]
        tmp_6d = calligraphy_tool.three_to_six(sample_3d, sample_angle)

        out_6dcmd = np.append(out_6dcmd,
                              calligraphy_tool.six_to_cmd(tmp_6d, sample_cmd),
                              0)

sample_3d[0][2] += 50
tmp_6d = calligraphy_tool.three_to_six(sample_3d, sample_angle)
out_6dcmd = np.append(out_6dcmd,
                      calligraphy_tool.six_to_cmd(tmp_6d, sample_cmd), 0)

out_6dcmd = np.append(out_6dcmd, end6dcmd, 0)

save_file(f'../../data/output/rect.txt', out_6dcmd)
コード例 #3
0
        if i == 6:  #代
            data_3d_transformed = calligraphy_tool.transform_3d(
                data_3d_transformed, translate=[0, 0, -2], thresholdZ=tmpz)
        if i == 7:  #謝
            data_3d_transformed = calligraphy_tool.transform_3d(
                data_3d_transformed, translate=[0, 0, -2.5], thresholdZ=tmpz)

        data_6d = calligraphy_tool.three_to_six(data_3d_transformed,
                                                data_angle)
        output_6d, output_cmd = calligraphy_tool.data_6d_cmd_concate(
            data_6d, water_6d, data_cmd, water_cmd)
        output_6dcmd = calligraphy_tool.six_to_cmd(output_6d, output_cmd)
        for j in range(len(output_6dcmd)):
            output_6dcmd[j][-2] = 350.0
        output_6dcmd = np.append(output_6dcmd, end6dcmd, 0)
        save_file(f'{output_path}/{words[i]}.txt', output_6dcmd)

        calligraphy_tool.visualize_line_3d(data_3d_transformed,
                                           data_cmd,
                                           z0_point,
                                           with_thickness=True,
                                           plot=False)
        print(i)

        if i == 4:
            final_output = output_6dcmd
        else:
            final_output = np.append(final_output, output_6dcmd, 0)

    save_file(f'{output_path}/final.txt', final_output)
コード例 #4
0
if __name__ == '__main__':
    path = '../data/代.txt'
    output_path1 = '../o/3d.txt'
    output_path2 = '../o/3d_1.txt'
    output_path3 = '../o/3d_2.txt'
    output_path4 = '../o/6dcmd.txt'

    calligraphy_tool = calligraphy_transform()
    z0_point = 5.5  #3.21083745 [-66.7041, 438.85, 187.479, -177.603, 4.50068, -9.48322] -2.85887236e-03 [-130.099, 459.278,182.715,175.55,-7.84099,70.2961]
    data_6d, data_cmd = calligraphy_tool.read_file(path, is_6dcmd=True)
    data_3d, data_angle = calligraphy_tool.six_to_three(data_6d)
    calligraphy_tool.visualize_line_3d(data_3d,
                                       data_cmd,
                                       z0_point,
                                       with_thickness=True)
    save_file(output_path1, data_3d)

    data_3d_transformed = calligraphy_tool.transform_3d(
        data_3d,
        anchor=calligraphy_tool.find_anchor(data_3d, z0_point),
        ratio=[0.5, 0.5, 0.35],
        translate=[0, 0, 0])
    calligraphy_tool.visualize_line_3d(data_3d_transformed,
                                       data_cmd,
                                       z0_point,
                                       with_thickness=True)
    save_file(output_path2, data_3d_transformed)

    data_3d_transformed = calligraphy_tool.transform_to_rect_3d(
        data_3d, [-40, 40, -40, 40],
        z0_point,