How to set reference objects using RCP instead of GH nodes

Hi, I’m trying to run some scripts completely on remote control panel without open up grasshopper again:

Sliders and Boolean button works great, and with python scripts,
I can easily bake output objects too, the problem is on the input:
Is it possible to toggle Boolean button on RCP so that I can trigger selected object feature (instead of run the method first then select objects)

and then the referenced objects will update automatically like how it works as a normal geometry nodes in GH.

below is my files, thanks in advance :slight_smile:
DrawWalls.3dm (29.9 KB) DrawWalls.gh (9.7 KB)

the trigger variable is there to avoid GH canvas being locked up. you can search around the forum. it’s a known issue. also after you click the button you have to first click into the viewport before picking objects. i think someone on here might have solved that but I don’t remember

import Rhino as rh
import Rhino.Input.RhinoGet as rhget

if 'trigger' not in globals():
    trigger = False

def funcDrawDoor(x):
    global trigger
    if x and not trigger:
        trigger = True
        return None
    elif not x and trigger:
       trigger = False
       r,orefs = rhget.GetMultipleObjects(' pick lines', True, rh.DocObjects.ObjectType.Curve)
       if r!=rh.Commands.Result.Success:
           return None
       else:
           return [o.Curve() for o in orefs]
    else:
        trigger = False
        return None

a = funcDrawDoor(x)

RCP trigger.gh (9.7 KB)

2 Likes

Thank you, the script works perfectly!!
I’ve searched the forum before and knew that trigger button may cause some issue more often than boolean toggles, that’s why I used toggles instead, but your script works good without any problem!

Thanks again for your kindly help!
Finally I can release some space on the screen for Rhino viewport!!

Nice solution, Thanks! Could you please help me, how to get GUID of objects that we get by this method?

in that script, wherever you need a guid, just call oref.ObjectId

It turned out that I was not so smart enough for this task =(
Сould you please help me and provide a script snippet?

Runtime error (ArgumentTypeException): Guid is not callable

Please, someone could help me? I’m trying to reference rhino text object into grasshopper through RCP. The only way afaik is to get GUID of text object, but I don’t know how to get it through python script =(