GetPoint RCommon

go = rh.Input.Custom.GetPoint()
go.SetCommandPrompt("Select Point")
go.AcceptNothing(True)
go.Get()

AcceptNothing(self: GetBaseClass, enable: bool)
If you want to allow the user to be able to press enter in order to
skip selecting a something in GetPoint.Get(), GetObject::GetObjects(), etc., then call AcceptNothing( true ) beforehand.

enable: true if user is able to press enter in order to skip selecting.

ma usando AcceptNothing non dovrebbe accettare e gestire un valore nullo premendo il tasto Invio?

Con AcceptNothing l’input accetta il tasto Enter come risposta.
Il risultato dell’operazione di input lo verifichi tramite il metodo
GetBaseClass.CommandResult Method (rhino3d.com)
oppure con
GetBaseClass.Result Method (rhino3d.com)

Ad esempio GetPoint di rhinoscriptsyntax utilizza CommandResult

def GetPoint(message=None, base_point=None, distance=None, in_plane=False):
    gp = Rhino.Input.Custom.GetPoint()
    if message: gp.SetCommandPrompt(message)
    base_point = rhutil.coerce3dpoint(base_point)
    if base_point:
        gp.DrawLineFromPoint(base_point,True)
        gp.EnableDrawLineFromPoint(True)
        if distance: gp.ConstrainDistanceFromBasePoint(distance)
    if in_plane: gp.ConstrainToConstructionPlane(True)
    gp.Get()
    if gp.CommandResult()!=Rhino.Commands.Result.Success:
        return scriptcontext.errorhandler()
    pt = gp.Point()
    gp.Dispose()
    return pt

Per rendere il plugin user friendly lo sviluppatore memorizza e ripropone un valore
di input inserito in precedenza. Di conseguenza il codice successivo al get deve essere
molto più strutturato. Ma … non vedo il problema. Tutto quello che vien dopo lo devi
gestire tu …

ok provando con CommandResult() qui cambia il risultato, e quindi va gestito
mentre invece se viene omesso CommandResult() il punto viene riportato comunque
(credevo che venisse gestito internamente in automatico senza dover poi usare CommandResult())

ths @emilio @Sergio_Alessi :+1:

1 Mi Piace

NON DEVI OMETTERLO!

infatti lo sto usando in tutti i codici, quella stavo facendo una prova per vedere come funzionasse
go.AcceptNothing(True) come già detto, credevo che il punto non venisse proprio accettato
mentre invece il punto viene accettato, ma CommandResult() ritorna cancel

Continua a provare! :+1:

certamente già sono andato oltre, questa ormai è archiviata.