def GetPointOnSurface(surface_id, message=None): """Pauses for user input of a point constrained to a surface or polysurface object Parameters: surface_id = identifier of the surface to get a point on message [opt] = a prompt or message Returns: 3d point if successful None on error """ surfOrBrep = rhutil.coercesurface(surface_id) if not surfOrBrep: surfOrBrep = rhutil.coercebrep(surface_id, True) gp = Rhino.Input.Custom.GetPoint() if message: gp.SetCommandPrompt(message) if isinstance(surfOrBrep, Rhino.Geometry.Surface): gp.Constrain(surfOrBrep, False) else: gp.Constrain(surfOrBrep, -1, -1, False) gp.Get() if gp.CommandResult() != Rhino.Commands.Result.Success: return scriptcontext.errorhandler() pt = gp.Point() gp.Dispose() return pt
def GetPointOnSurface(surface_id, message=None): """Pauses for user input of a point constrained to a surface or polysurface object Parameters: surface_id = identifier of the surface to get a point on message [opt] = a prompt or message Returns: 3d point if successful None on error """ surfOrBrep = rhutil.coercesurface(surface_id) if not surfOrBrep: surfOrBrep = rhutil.coercebrep(surface_id, True) gp = Rhino.Input.Custom.GetPoint() if message: gp.SetCommandPrompt(message) if isinstance(surfOrBrep,Rhino.Geometry.Surface): gp.Constrain(surfOrBrep,False) else: gp.Constrain(surfOrBrep, -1, -1, False) gp.Get() if gp.CommandResult()!=Rhino.Commands.Result.Success: return scriptcontext.errorhandler() pt = gp.Point() gp.Dispose() return pt
def GetPointOnSurface(surface_id, message=None): """Pauses for user input of a point constrained to a surface or polysurface object Parameters: surface_id (guid): identifier of the surface to get a point on message (str, optional): a prompt or message Returns: point: 3d point if successful None: on error Example: import rhinoscriptsyntax as rs surface = rs.GetObject("Pick a surface") if surface: point = rs.GetPointOnSurface(surface, "Point on surface") if point: rs.AddPoint(point) See Also: GetPoint GetPointOnCurve GetPointOnMesh GetPoints """ surfOrBrep = rhutil.coercesurface(surface_id) if not surfOrBrep: surfOrBrep = rhutil.coercebrep(surface_id, True) gp = Rhino.Input.Custom.GetPoint() if message: gp.SetCommandPrompt(message) if isinstance(surfOrBrep,Rhino.Geometry.Surface): gp.Constrain(surfOrBrep,False) else: gp.Constrain(surfOrBrep, -1, -1, False) gp.Get() if gp.CommandResult()!=Rhino.Commands.Result.Success: return scriptcontext.errorhandler() pt = gp.Point() gp.Dispose() return pt
def GetPointOnSurface(surface_id, message=None): """Pauses for user input of a point constrained to a surface or polysurface object Parameters: surface_id = identifier of the surface to get a point on message [opt] = a prompt or message Returns: 3d point if successful None on error Example: import rhinoscriptsyntax as rs surface = rs.GetObject("Pick a surface") if surface: point = rs.GetPointOnSurface(surface, "Point on surface") if point: rs.AddPoint(point) See Also: GetPoint GetPointOnCurve GetPointOnMesh GetPoints """ surfOrBrep = rhutil.coercesurface(surface_id) if not surfOrBrep: surfOrBrep = rhutil.coercebrep(surface_id, True) gp = Rhino.Input.Custom.GetPoint() if message: gp.SetCommandPrompt(message) if isinstance(surfOrBrep,Rhino.Geometry.Surface): gp.Constrain(surfOrBrep,False) else: gp.Constrain(surfOrBrep, -1, -1, False) gp.Get() if gp.CommandResult()!=Rhino.Commands.Result.Success: return scriptcontext.errorhandler() pt = gp.Point() gp.Dispose() return pt