def point_to_parameter(self, pt): ''' returns the uv value of a point on a surface @param pt: ''' sas = ShapeAnalysis_Surface(self.surface_handle) uv = sas.ValueOfUV(pt, self.tolerance) return uv.Coord()
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()