Exemplo n.º 1
0
if __name__ == "__main__":
    argvs = sys.argv
    parser = argparse.ArgumentParser()
    parser.add_argument("--dir", dest="dir", default="./")
    parser.add_argument("--out", dest="out", default="./")
    parser.add_argument("--refe", dest="refe", default="surf1")
    parser.add_argument("--surf", dest="surf", default="surf2")
    parser.add_argument("--pxyz", dest="pxyz",
                      default=(0, 0, 0), type=float, nargs=3)
    parser.add_argument("--rxyz", dest="rxyz",
                      default=(0, 0, 0), type=float, nargs=3)
    opt = parser.parse_args()
    print(opt, argvs)

    filename = opt.dir + opt.refe + ".cor"
    ax = get_axs(filename)
    print(dir_to_vec(ax.Direction()), ax.Location())
    ax.Translate(gp_Vec(gp_Pnt(), gp_Pnt(*opt.pxyz)))
    for i, deg in enumerate(opt.rxyz):
        if i == 0:
            axs = gp_Ax1(ax.Location(), ax.XDirection())
        elif i == 1:
            axs = gp_Ax1(ax.Location(), ax.YDirection())
        elif i == 2:
            axs = gp_Ax1(ax.Location(), ax.Direction())
        else:
            axs = gp_Ax1(ax.Location(), ax.Direction())
        ax.Rotate(axs, np.deg2rad(deg))
    print(dir_to_vec(ax.Direction()), ax.Location())
    occ_to_grasp_cor(ax, opt.surf, opt.out + opt.surf + ".cor")
Exemplo n.º 2
0
    v1 = v0.Mirrored(gp_Ax2(p1, vec_to_dir(vz), vec_to_dir(vx)))
    norm_ax = gp_Ax3(p1, vec_to_dir(vz), vec_to_dir(vx))
    beam_ax = gp_Ax3(p1, vec_to_dir(v1), beam.XDirection().Reversed())
    return beam_ax, norm_ax, 1


if __name__ == "__main__":
    argvs = sys.argv
    parser = OptionParser()
    parser.add_option("--dir", dest="dir", default="./")
    opt, argc = parser.parse_args(argvs)
    print(argc, opt)

    display, start_display, add_menu, add_function_to_menu = init_display()

    beam = get_axs("./beam_cyl.cor")
    surf = set_surface("./cylinder.stp")
    display.DisplayShape(surf)
    # display.DisplayShape(axs_pln(gp_Ax3()))
    # display.DisplayShape(axs_pln(beam))

    axs1 = beam
    val = 1
    while val != None:
        axs0 = axs1
        axs1, axs, val = reflect_axs2(axs0, surf, indx=2)
        get_deg(axs, dir_to_vec(axs1.Direction()))
        if val != None:
            display.DisplayShape(
                make_line(axs0.Location(), axs1.Location()), color="GREEN")
Exemplo n.º 3
0
from OCC.Core.gp import gp_Pln, gp_Trsf, gp_Lin, gp_Elips, gp_Elips2d
from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Dir, gp_Ax1, gp_Ax2, gp_Ax3
from OCC.Display.SimpleGui import init_display

if __name__ == "__main__":
    argvs = sys.argv
    parser = OptionParser()
    parser.add_option("--dir", dest="dir", default="./")
    opt, argc = parser.parse_args(argvs)
    print(argc, opt)

    init = "surf1"
    surf = ["surf2", "surf3", "surf4"]

    obj = Multi_RaySystem("./", init, "surf2")
    obj.ini.beam = get_axs("./" + obj.ini.name + "_beam.cor", obj.ini.axs)

    obj.ini.beam_rght = get_axs("./" + obj.ini.name + "_beam_rght.cor",
                                obj.ini.axs)
    obj.ini.beam_left = get_axs("./" + obj.ini.name + "_beam_left.cor",
                                obj.ini.axs)
    obj.ini.beam_uppr = get_axs("./" + obj.ini.name + "_beam_uppr.cor",
                                obj.ini.axs)
    obj.ini.beam_bott = get_axs("./" + obj.ini.name + "_beam_bott.cor",
                                obj.ini.axs)

    obj.MultiReflect()
    print(obj.tar.beam.Location())
    print(obj.tar.beam_rght.Location())
    print(obj.tar.beam_left.Location())
    print(obj.tar.beam_uppr.Location())
Exemplo n.º 4
0
    v1 = v0.Mirrored(gp_Ax2(p1, vec_to_dir(vz), vec_to_dir(vx)))
    norm_ax = gp_Ax3(p1, vec_to_dir(vz), vec_to_dir(vx))
    beam_ax = gp_Ax3(p1, vec_to_dir(v1), beam.XDirection().Reversed())
    return beam_ax, norm_ax, 1


if __name__ == "__main__":
    argvs = sys.argv
    parser = argparse.ArgumentParser()
    parser.add_argument("--dir", dest="dir", default="./")
    opt = parser.parse_args()
    print(opt, argvs)

    display, start_display, add_menu, add_function_to_menu = init_display()

    beam = get_axs("../input/beam_cyl.cor")
    surf = set_surface("../input/cylinder.stp")
    display.DisplayShape(surf)
    # display.DisplayShape(axs_pln(gp_Ax3()))
    # display.DisplayShape(axs_pln(beam))

    axs1 = beam
    val = 1
    while val != None:
        axs0 = axs1
        axs1, axs, val = reflect_axs2(axs0, surf, indx=2)
        get_deg(axs, dir_to_vec(axs1.Direction()))
        if val != None:
            display.DisplayShape(make_line(axs0.Location(), axs1.Location()),
                                 color="GREEN")