Setting a vector in Human UI and and a point

How would I go about defining a North vector in Human UI.?
I don’t have Rhino geometry to select and would like to simply click start and end of the vector to get a direction…

Also how do I select a location/point without a point to select…?

thanks

How I would do this (off the top of head, not at my machine).

Use a HumanUI button as an input to a GHpython component. In the component you will have about 4 lines of code.

I’d use either the GetPoints or GetLine User input methods in RhinoScriptSyntax to prompt the user to click two points and return these to the python component output.

If you need more info than that reply this thread and I’ll mock it up when I’m back in my office.

Cheers

DK

By convention ‘Y’ is north. You don’t need Human UI for any of these things.

missing

My problem is that the architectural models I receive rarely have North in the Y direction and the North direction matters a lot when I run HB simulations

@Kiteboadeshapers approach sounds like the way to go…

@kiteboardshaper, Sounds perfect, and I’d greatly appreciate a mockup to start from, when you have a moment

thanks

Yet you didn’t post any geometry, as recommended. Still no reason to use a plugin.

3. Attach minimal versions of all the relevant files

I understand and was just trying to get my head around how to use Human UI as a friendly front end to a large grasshopper script using HB and LB to run sun simulations. The Human UI aspect is a separate issue and I didn’t think to include it…

Here is a screenshot that shows how I’m using Human + Human UI to refresh a ‘data dam’ and I’d like to do the same when setting the vector and a points, but as Human UI’s ‘Rhino Pick button’ requires a ‘physical’ point to select and has no tool for vectors…and so I’m stumped.

Hi @anders

Please find my solution attached:

Cheers

DK
240509_Get Vector with HumanUI.gh (10.5 KB)

import rhinoscriptsyntax as rs

if Get_Points:
    point1 = rs.GetPoint("select first point", None, None, True)
    point2 = rs.GetPoint("select second point", None, None, True)

A = point1
B = point2

the last ‘True’ in the rs.GetPoint keeps the selection to only the current CP plane - that I believe matches your requirements. Check the Rhino Script Syntax docs if you want to amend.

Cheers

DK

@kiteboardshaper Thankyou!
I can see that I need to learn Python and the RhinoScript…this is such a nice an direct solution.

PS have you tried Synapse to make cross-platform UIs?..there is not a lot of guidance around, but it would be nice to make a UI that also works on a mac.

thanks

Hi Anders,

My Kite Design plugin www.karorocad.com was first developed with HumanUI, but I was very keen to get it to work cross platform.

I did try Synapse, but like ETO that it is based on I found the learning curve too steep to make any real progress.

What I ended up doing was developing my own HumanUI replacement based on Webview:

This has been my production code UI since the start of the year, has needed some tweaks to work in R8 but I’m pretty happy where it is now at.

I’ve been toying with the idea of compiling the UI as a GH plug-in to offer as an alternative to HumanUI. UI+, Synapse etc, but time is a factor here. Watch this space as the winter (development time) progresses in Cape Town.

Cheers

DK

Hi @kiteboardshaper , thank you for all your help.
I’ve been trying to implement your solutions, but have run into a strange problem

When I hit the button in the Human UI window to select the two points it works just fine (if I set the input to ‘List access’ and type hint to ‘ghdoc object’, I get an ‘undefined’ if I don’t) , but the action repeats so I have to select the set of points twice.

Any idea why and what I can do about it?
thanks



Human UI two points

Let me test in R8 and come back to you…

I think my problem was that I set it to List access…When i set it to Item Access all is working again

Hi Anders,

Yeah - no list access needed, and type hint should be bool.

R8 scripting components have changed a few things from R7, this code is likely more robust:

Also gives a default Yaxis = North on loading rather than the error shown in the other code.

For some reason HumanUI is not working in my R8, but I’m not likely to use it there moving forward so attached uses a toggle component instead.

Cheers

DK
240513_Get Vector R8.gh (10.5 KB)

import rhinoscriptsyntax as rs
import scriptcontext as sc

if not sc.sticky.has_key("point1"):
    sc.sticky["point1"] = "0,0,0"
    sc.sticky["point2"] = "0,50,0"

if Get_Points:
    get_point1 = rs.GetPoint("select first point", None, None, True)
    get_point2 = rs.GetPoint("select second point", None, None, True)
    sc.sticky["point1"] = get_point1
    sc.sticky["point2"] = get_point2

A = sc.sticky["point1"]
B = sc.sticky["point2"]

Thanks! Yours is the best script I have found for the problem thus far. I think Human UI is great but being unable to set geometry like you can with the grasshopper player or grasshopper parameters is severally lacking.

Is there any way to avoid the extra click on the rhino viewport window before setting the points?

YES! Funny question, I was having this exact issue in MacOS (not with HumanUI but similar work flow) which was sorted out here:

Adding Rhino.RhinoApp.SetFocusToMainWindow() before the GetPoint code will remove that extra click.

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino



if not sc.sticky.has_key("point1"):
    sc.sticky["point1"] = "0,0,0"
    sc.sticky["point2"] = "0,50,0"

if Get_Points:
    Rhino.RhinoApp.SetFocusToMainWindow()
    get_point1 = rs.GetPoint("select first point", None, None, True)
    get_point2 = rs.GetPoint("select second point", None, None, True)
    sc.sticky["point1"] = get_point1
    sc.sticky["point2"] = get_point2

A = sc.sticky["point1"]
B = sc.sticky["point2"]

240709_Get Vector with HumanUI.gh (10.6 KB)

Thanks! For posterity, here’s my version so that you can see the points being created as you produce them and create as many points as you need.

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

if not sc.sticky.has_key(“point1”):
sc.sticky[“point1”] = “0,0,0”
sc.sticky[“point2”] = “0,50,0”

if Get_Points:
Rhino.RhinoApp.SetFocusToMainWindow()
get_point1 = rs.GetPoints(True,False,“Set First Point”,“Set Next Point”,2)
sc.sticky[“point1”] = get_point1

pt1 = sc.sticky[“point1”]

1 Like