# Rotate From variable line length

**URL:** <https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473>\
**Category:** Grasshopper\
**Created:** [May 25, 2017, 7:21pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473 "2017-05-25T19:21:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken\_Charron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ken_charron/32/633756_2.png) [@Ken\_Charron](https://discourse.mcneel.com/u/Ken_Charron)\
**Post date:** [May 25, 2017, 7:21pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/1 "2017-05-25T19:21:15Z")

</div>

I can rotate a line generated by GH using a slider. But now I’m looking to rotate that same line by pushing the end of it with another line… sort of like a connection rod to a crank shaft. I want to adjust the length of the rod with a slider so I can see what angle I get on the line it’s connected to.

---

<div class="post-metadata">

**Author:** ![RIL](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ril/32/771758_2.png) [@RIL](https://discourse.mcneel.com/u/RIL)\
**Post date:** [May 26, 2017, 11:52am UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/2 "2017-05-26T11:52:23Z")

</div>

> [@Ken\_Charron](#):
>
> sort of like a connection rod to a crank shaft.

I think you should take a look at Bongo **Animation** , which makes Rhino “come alive”. (Rhino isn’t in itself an animation tool). here some [Sample models](http://bongo.rhino3d.com/page/sample-models) :

[http://api.ning.com/files/O3p1FaWf5ActQeozs72HEqao-z\*QSl06wZpISuLlgJiumqs3MVBZXiwXhlA6WISs5tS9TZwlPWlKyKdbqTWoXW3xjEl0z6Lc/Machinery.gif](http://api.ning.com/files/O3p1FaWf5ActQeozs72HEqao-z*QSl06wZpISuLlgJiumqs3MVBZXiwXhlA6WISs5tS9TZwlPWlKyKdbqTWoXW3xjEl0z6Lc/Machinery.gif)

[http://api.ning.com/files/O3p1FaWf5Af8fHz-oW6xc1VBmP8RjbKpPj5xBsIdUfFKhiFPYY\*P12cBnk3vGc0YxdDLwue1xp5XvxmUn\*Oa1WgcuBkggSvO/Pistons.gif](http://api.ning.com/files/O3p1FaWf5Af8fHz-oW6xc1VBmP8RjbKpPj5xBsIdUfFKhiFPYY*P12cBnk3vGc0YxdDLwue1xp5XvxmUn*Oa1WgcuBkggSvO/Pistons.gif)

[http://api.ning.com/files/O3p1FaWf5AevyJtkD6m4v5TR9k2q0HR4kTcdjJ8BTMLFWYCEN0lAZtnJj6zvc7286QgKwMX45a0RECZNfpcl6xrjqlPUd43f/Excavator.gif](http://api.ning.com/files/O3p1FaWf5AevyJtkD6m4v5TR9k2q0HR4kTcdjJ8BTMLFWYCEN0lAZtnJj6zvc7286QgKwMX45a0RECZNfpcl6xrjqlPUd43f/Excavator.gif)

// Rolf

---

<div class="post-metadata">

**Author:** ![Ken\_Charron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ken_charron/32/633756_2.png) [@Ken\_Charron](https://discourse.mcneel.com/u/Ken_Charron)\
**Post date:** [May 26, 2017, 12:05pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/3 "2017-05-26T12:05:18Z")

</div>

Man! Now we’re talking! First GH, then Kangaroo, now Bongo. But wait… this is for PC only.

Are you sure nothing like this can be done in GH or Kangaroo?

---

<div class="post-metadata">

**Author:** ![RIL](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ril/32/771758_2.png) [@RIL](https://discourse.mcneel.com/u/RIL)\
**Post date:** [May 26, 2017, 12:40pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/4 "2017-05-26T12:40:04Z")

</div>

> [@Ken\_Charron](#):
>
> this is for PC only.

I use PC only, knowing nothing about Mac. My son uses Mac, and so I pretend to not know him either. 🙂

But regarding GH I can say in general that anything can be done, that can be done in GH / Kangaroo. But some things are easier to do than other things. You actually _can_ do almost anything in Rhino - if you do some scripting.

All this only means that _ **wherever there is scripting capability** _, there you can do almost anything. And Rhino can be scripted, and GH can be scripted.

GH is special in that it’s focus is on simplifying trigonometry and math a bit, by providing a visual way of doing the scripting. Kangaroo also provides you with some “already-done- math” in physics, which also helps a bit. So it is with tools, they’re there to help, to simplify. But if you know all the math, and how to script, then you don’t need no Gh, and no Kangaroo. And no Rhino either.

Real men do all the coding on his own, from scratch. 🙂

Just joking. Bongo does the job for you in that it is a specialized tool for animations. GH can animate too, but it’s not specialized for doing that (but not too tricky I think). Anyway, it’s all about how helpful the different tools are for what you want to do.

But if you want to do animation, it is not a bad idea to look into an animation tool. Bongo is an animation tool for Rhino. But if you are a Mac user, then who can help you? 🙂

// Rolf

---

<div class="post-metadata">

**Author:** ![jeff\_hammond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeff_hammond/32/768846_2.png) [@jeff\_hammond](https://discourse.mcneel.com/u/jeff_hammond)\
**Post date:** [May 28, 2017, 4:18am UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/5 "2017-05-28T04:18:55Z")

</div>

> [@Ken\_Charron](#):
>
> Are you sure nothing like this can be done in GH or Kangaroo?

in grasshopper, you can animate a slider :

[wheelrod.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/4/c/4c5009c1aac3c8d016a6e12107668b923329b371.gh) (17.1 KB)

[https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/0/1/01146f0f9ffab11acc8159e1dc8deb162f1949ab.mov](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/0/1/01146f0f9ffab11acc8159e1dc8deb162f1949ab.mov)

---

<div class="post-metadata">

**Author:** ![Ken\_Charron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ken_charron/32/633756_2.png) [@Ken\_Charron](https://discourse.mcneel.com/u/Ken_Charron)\
**Post date:** [May 28, 2017, 1:26pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/6 "2017-05-28T13:26:00Z")

</div>

This is stunning. I’m going to have to examine this a little.

Thanks!

---

<div class="post-metadata">

**Author:** ![jeff\_hammond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeff_hammond/32/768846_2.png) [@jeff\_hammond](https://discourse.mcneel.com/u/jeff_hammond)\
**Post date:** [May 28, 2017, 4:42pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/7 "2017-05-28T16:42:39Z")

</div>

> [@Ken\_Charron](#):
>
> This is stunning. I’m going to have to examine this a little.
> 
> Thanks!

it’s mostly using the Expressions component to determine where the rod should be…  
`a² + b² = c²` finds where the rod should be along the X axis…  
`sin = opposite/hypotenuse` is determining the angle.

that could probably be streamlined a little further into using one Expression instead of two. 😉

---

<div class="post-metadata">

**Author:** ![Ken\_Charron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ken_charron/32/633756_2.png) [@Ken\_Charron](https://discourse.mcneel.com/u/Ken_Charron)\
**Post date:** [May 28, 2017, 6:32pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/8 "2017-05-28T18:32:40Z")

</div>

Ok, I’m almost there. How can I generate a point on an ARC based on the distance from a reference point?

So I have a reference point in my project, and far off to the side I have an ARC. The ARC is positioned in a way that no two points on the ARC can share the same distance to the reference point (the arc is perpendicular to the reference point).

I would like to know where on the ARC is the 100mm position from the reference point. I was using the Evaluate Curve function but it came up with an error. Something about a parameter being outside the domain of something.

---

<div class="post-metadata">

**Author:** ![jeff\_hammond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeff_hammond/32/768846_2.png) [@jeff\_hammond](https://discourse.mcneel.com/u/jeff_hammond)\
**Post date:** [May 28, 2017, 6:56pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/9 "2017-05-28T18:56:22Z")

</div>

initial thought just using geometry would be :

 ![](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/a/0/a0b07826049a4bd9c6253e0a6862f5eb4dd73f6b.png)

* * *

* * *

draw a circle with radius 50 using the point as center… where it interests the other arc is the point you’re looking for.

 ![](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/8/c/8cc74a14230f7d7b760c35d334b717d85b49b036.png) 

* * *

that said, there may be a better way 😉

---

<div class="post-metadata">

**Author:** ![Ken\_Charron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ken_charron/32/633756_2.png) [@Ken\_Charron](https://discourse.mcneel.com/u/Ken_Charron)\
**Post date:** [May 28, 2017, 7:07pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/10 "2017-05-28T19:07:28Z")

</div>

This is great for 2D. However, in 3D the circle will have to be on the same plane as the arc. As it turns out, these don’t work when I have a slider for positioning of the arc and the circle.

I think I have an extremely clunky solution to this. So my reference point now has a sphere centred on it. Then I feed the sphere into a Brep so I can use the Brep/Curve intersect function. With a slider driving the diameter of the sphere, I can move the intersection point on the ARC at a precise distance from the reference point. Then I can use that point to draw a line. It’s super clunky because I have to hide the sphere just to see the effect I need. I feel it’s like using a shoe as a hammer and a butterknife as a screwdriver.

Are there any math / trig gurus out there who can clean this up?  
 ![](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/4/0/4043b112c02539115ee81000b8b63ca2a8385950.png)

---

<div class="post-metadata">

**Author:** ![DavidRutten](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/davidrutten/32/755688_2.png) [@DavidRutten](https://discourse.mcneel.com/u/DavidRutten)\
**Post date:** [May 28, 2017, 7:28pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/11 "2017-05-28T19:28:33Z")

</div>

In 3D, use a sphere.

---

<div class="post-metadata">

**Author:** ![Ken\_Charron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ken_charron/32/633756_2.png) [@Ken\_Charron](https://discourse.mcneel.com/u/Ken_Charron)\
**Post date:** [May 28, 2017, 7:30pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/12 "2017-05-28T19:30:46Z")

</div>

Yes, That’s what I did. But it seems super clunky.

---

<div class="post-metadata">

**Author:** ![jeff\_hammond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeff_hammond/32/768846_2.png) [@jeff\_hammond](https://discourse.mcneel.com/u/jeff_hammond)\
**Post date:** [May 28, 2017, 7:31pm UTC](https://discourse.mcneel.com/t/rotate-from-variable-line-length/44473/13 "2017-05-28T19:31:54Z")

</div>

> [@Ken\_Charron](#):
>
> It’s super clunky because I have to hide the sphere just to see the effect I need.

that’s not necessarily an indicator of clunkiness (imo)

* * *

if you do it in a way without using the sphere & intersections, you’re either going to end up with a highly complex equation (if the equation is possible to begin with)… or some sort of form finding setup which can automatically test the distance at various points along the arc and return the best-fit solution.

grasshopper’s Galapagos does this… (though i’m not convinced this is the best way to approach this particular scenario)

 ![](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/5/7/571b01c5aec9f7ee131ed687920198378e795bba.png)
