Esempio n. 1
0
def wavefront_xyz(x, y, z, axs=gp_Ax3()):
    phas = surf_spl(x, y, z)

    trf = gp_Trsf()
    trf.SetTransformation(axs, gp_Ax3())
    loc_face = TopLoc_Location(trf)
    phas.Location(loc_face)
    return phas
Esempio n. 2
0
def wavefront(rxy=[1000, 1000], axs=gp_Ax3()):
    px = np.linspace(-1, 1, 100) * 10
    py = np.linspace(-1, 1, 100) * 10
    mesh = np.meshgrid(px, py)

    rx_0 = curvature(mesh[0], rxy[0], 0)
    ry_0 = curvature(mesh[1], rxy[1], 0)
    ph_0 = rx_0 + ry_0
    phas = surf_spl(*mesh, ph_0)

    trf = gp_Trsf()
    trf.SetTransformation(axs, gp_Ax3())
    loc_face = TopLoc_Location(trf)
    phas.Location(loc_face)
    return phas
Esempio n. 3
0
from optparse import OptionParser
sys.path.append(os.path.join('../'))

from src.fileout import occ_to_grasp_cor, occ_to_grasp_rim
from src.geomtory import curvature, grasp_sfc
from src.geomtory import fit_surf
from src.pyocc.surface import surf_spl
from src.pyocc.export import export_STEPFile_single

from OCC.gp import gp_Pnt, gp_Vec, gp_Dir
from OCC.gp import gp_Ax1, gp_Ax2, gp_Ax3

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

    filename = opt.dir + opt.surf + "_mat.sfc"
    xs, ys, xe, ye = [float(v) for v in getline(filename, 2).split()]
    nx, ny = [int(v) for v in getline(filename, 3).split()]
    px = np.linspace(xs, xe, nx)
    py = np.linspace(ys, ye, ny)
    mesh = np.meshgrid(px, py)
    data = np.loadtxt(filename, skiprows=3)
    surf = surf_spl(*mesh, data)

    export_STEPFile_single(surf, opt.dir + opt.surf + ".stp")