# Point on GH generated line

Sorry for the noob question, but I’m hoping someone can tell me how to do the following:

I’ve used GH to draw a line with an angle from two Rhino defined points. No big deal.

Then I wanted to control the length of that line, so I slapped on a number slider… all good.

Now I want to draw a second line starting off the end of the first. The idea is to adjust the length of the line as an input to the start position of the second line. However, I can’t seem to get anything to listen to the end location of the first line, which as I said is on an angle.

Am I approaching this wrong?

Would EndPoints do what you are looking for?

// Rolf

Not really, as I only have a vector, not a second endpoint.

Imagine constructing a crane out of lines with GH. You want the first line to represent the height of the crane, the second line will represent the boom off the top of the crane. To that, the length of the tower will be defined by a number slider, and the start position of the second line. Now, I can do it with a “Point on Curve” function, but the slide value is relative from 0-1, and accepts no absolute values. It does output a value that will set the position of the second start position, but it’s effectively useless if you can’t control it with absolute values.

I thought you were saying that you did have the first line (quote “the length of that line, so I slapped on a number slider… all good”). “All good” indicating that it all went well. Or did you not have the first line?

// Rolf

Yes. I can adjust the length of a line in GH. There is no problem with that. Simply use an SDL line and feed a slider into the length input. The problem is, the length of the line is a GH line, not a Rhino line. So I can’t attach anything on the end of that line — not that I’ve seen anyhow. I would love to assign a point to the end of that line so I can use it as the start point of a second line.

How can I assign a Rhino point (or even a GH point) to the end of a GH line? Am I going about this all wrong?

OK, so skip the first `Line` component in my prior post and replace it with the `SDL Line` instead. And there are your end points. Use the correct end as the starting point for your second line and off you go.

Edit 1: Notice that your input doesn’t have to be a “Rhino point” or a Rhino Line, these components speak both Rhino objects and Gh objects “fluently”.

Edit 2: As a matter of fact, you don’t have to use any Rhino points or lines at all to start with. You can start by defining the Gh “ghost” points and lines in Gh only, and avoid Baking until all your geometry and calculations are done. For example, here is a “crane pillar center line” starting from pt 0,0,0 to pt 0,0,100 mm height, and no Rhino point exist as of yet, but the points & lines are still valid points and lines seen from Gh’s perspective.

// Rolf

Hey that worked. Thanks.

Baking? I burn everything I touch.

Thing is, I’ve developed an elaborate project and want to use GH to control geometry.

So now that I can control the position of a GH point, how do I control a Rhino point with it?

It depends on if you want only to draw that point in a static position (like any regular CAD model) after your GH definitions are done, then you “bake” your geometry (select a Gh component and click your Right Mouse Button somewhere on the Gh canvas, an you’ll see an option “Bake”. That means that your Gh definition (which I call the “ghost geometry”) will become concrete a CAD object(s) which you can click on etc.

But if you want a concrete Rhino point or line to move as you move the slider, then you will have to tell it to move. Well, you would have to make an animation that bakes stepwise as you move the slider. Or use Kangaroo, another plugin on top of Grasshopper (a so called “physics engine”) But that’s a different story.

If you know scripting, you could code a Python script, VB.NET Script or C# script to move any geometry. See dedicated components for that :

// Rolf

OK, So I have Kangaroo installed… now I have to learn Kanga, Grass, and Rhino for this project. Holy moly.

Thanks for the help.

If you use components that can bake “on demand” (see for example bake components in the Elefront plugin) you can tell Gh to change values in sliders in small steps (takes a bit of scripting as well) and have Gh to bake at every step.

If you can do with manual changes to the model, you can manually drag some “guides”, like I do in the gif below where the rest of the geometry updates after each manual move of the “guides” (the plane in this case). In the gif Gh bakes the geometry anew after each manual move, deleting the existing geometry before baking again in the new position. I just did this last night, and recorded the gif a minute ago.

Fig.1. “Bending steel” in realtime with Gh (low framerate due to file size) :

// Rolf

1 Like