Process the geometry as the result of a python method

Hi

This is an example how to get a point on a line. I would like to ask how to select the point (the result) of the TestFunction() method ?

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

normalEndP =    rs.CurveEndPoint (moveNormal)
normalStartP =  rs.CurveStartPoint (moveNormal, -1, None)

def GetPointOnLine(prompt,ptA,ptB,track):
    gp = Rhino.Input.Custom.GetPoint()
    gp.SetCommandPrompt(prompt)
    gp.Constrain(Rhino.Geometry.Line(ptA,ptB))
    gp.EnableDrawLineFromPoint(track)
    get_rc = gp.Get()
    if get_rc==Rhino.Input.GetResult.Point: 
        return gp.Point()

def TestFunction():
    msg1="Pick point on line"
    line_start=rs.coerce3dpoint(normalEndP)
    line_end=rs.coerce3dpoint(normalStartP)
    result=GetPointOnLine(msg1,line_start,line_end,True)
    print "result"
    print result
    if result: 
        rs.AddPoint(result)

The simplified version of the code above that could be straight forward

normalEndP =    rs.CurveEndPoint (moveNormal)
normalStartP =  rs.CurveStartPoint (moveNormal, -1, None)

rs.DeleteObject(edgeJoin)
line_start=rs.coerce3dpoint(normalEndP)
line_end=rs.coerce3dpoint(normalStartP)
gp = Rhino.Input.Custom.GetPoint()
gp.Constrain(Rhino.Geometry.Line(line_start,line_end))
gp.EnableDrawLineFromPoint(True)
get_rc = gp.Get()
gp.Point()

If you ‘catch’ the id of the create point you can than select it:

if result: 
        id = rs.AddPoint(result)
        rs.SelectObject(id)

does this help?
-Willem

Thanks Willem, Yes it is tricky, it works. The question did not cover what I wanted to know. I would process the result of the method. Eventually, I have found it by using global variables. It helped.