def uv_from_projected_point_on_face(face, pt):
    '''
    returns the uv coordinate from a projected point on a face
    '''
    srf = BRep_Tool().Surface(face)
    sas = ShapeAnalysis_Surface(srf)
    uv = sas.ValueOfUV(pt, 1e-2)
    print('distance ', sas.Value(uv).Distance(pt))
    return uv.Coord()
示例#2
0
def build_points_network(bspl_srf):
    """ Creates a list of gp_Pnt points from a bspline surface
    """
    # first create a face
    face = BRepBuilderAPI_MakeFace(bspl_srf, 1e-6).Face()
    # get face uv bounds
    umin, umax, vmin, vmax = shapeanalysis_GetFaceUVBounds(face)
    print(umin, umax, vmin, vmax)

    pnts = []
    sas = ShapeAnalysis_Surface(bspl_srf)

    u = umin
    while u < umax:
        v = vmin
        while v < vmax:
            p = sas.Value(u, v)
            print("u=", u, " v=", v, "->X=", p.X(), " Y=", p.Y(), " Z=", p.Z())
            pnts.append(p)
            v += 0.1
        u += 0.1
    return pnts