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()
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
def is_closed(self): sa = ShapeAnalysis_Surface(self.surface_handle) # sa.GetBoxUF() return sa.IsUClosed(), sa.IsVClosed()