algorithmic modeling for Rhino


I am learning VB, and I have a small problem In the "primer" manual page 111 :

new_line.rotate(angle, OnUtil.On_zaxis,Line_From)

the rotate function is called, but I have an error that this function does not exist

And I have an error also for "OnUtil.On_zaxis" :

'rotate' is not a member of 'rhino.geometry.line'

'Onutil is not declared'

Do you know where the problem comes from?

Views: 322

Reply to This

Replies to This Discussion

Which programming language is the easiest to learn among VB python C#? (The one most used and possibly with the most documentation)

Andrew Heumann wrote a terrific breakdown of the three scripting languages available through Grasshopper. If I were to add anything I would explicitly specify that we're talking about IronPython (the .NET version of Python, written in C#) and also start by pointing out the difference between dynamically typed (Python/IronPython) and statically typed (C#/VB) languages. While it's not exactly that cut and dry, the primary point is that in the latter you declare types and can compile your code (which is great if you're developing a plugin or a large codebase etc.) and the former tends to be terser (which is great for writing code on the fly and quickly testing algorithms etc.).


Thank you for your answer, I think I will program in C#

Are there tutorials (as in the "primer" for VB) written for grasshopper in c# ?


always nice to see people starting with coding here. This will actually simplify a lot for you in the world of grasshopper.

Anyway,here is one way on how to rotate a line. I made it in all three languages in order to prove, that all these languages have more in common as you might think. Language differences only become important when its about advanced coding. Python is generally seen as easier to learn, however to actually learn more about coding in general a less forgiving language like c# or will definitely pay off later on. If you know one, you can definitely switch over to another, or at least you will be able to understand most of it  . I would advice to learn very first basics about coding using a standard tutorial, not rhino related. Only to understand what all these keywords like class, struct, interface,static, private public... etc mean. This will simplify walking through the Rhino-related tutorials 


great ! it 's work !

Thank you very much

I have diplomas of computer programmers but it has been more than 10 years that I did not do so I must relearn softly ...


I have a little question, Here is my code

private void RunScript(Curve x, double t, ref object P, ref object T)

Point3d pt = new Point3d();
pt = x.PointAtNormalizedLength(t);

Vector3d vec ;
vec = x.TangentAt(t);
P = pt;
T = vec;


Why  I don't have the same thing as the component "evaluate curve"?

Tangent at is applied on curve parameter not normalized
You can surely use that to convert t
And you get the interval on the curve with domain

PointAtNormalizedLength() is not the same as PointAt() on a curve with a normalised domain.

In order to replicate the behaviour of the Evaluate Curve component, your code needs to look like:

private void RunScript(Curve x, double t, ref object P, ref object T)
  Interval domain = x.Domain;
  double parameter = domain.ParameterAt(t);
  Point3d pt = x.PointAt(parameter);
  Vector3d tan = x.TangentAt(parameter);
  P = pt;
  T = tan;

Thank you !!

I found when David replied ;-) 

Point3d pt = new Point3d();
Vector3d vec ;
Double t1;

t1 = x.Domain.ParameterAt(t);
pt = x.PointAt(t1);
vec = x.TangentAt(t1);

P = pt;
T = vec;

I have the same results as the component "evaluate curve" :D

By cons how can you have the length of a curve? Because the value of the domain does not give me the length.

"domain.T1" gives 27 and my length's curve is 24

I also have other small questions:

- Is it normal that the "run script" button does not work?  

List <Curve> c = new List <Curve> ();     

I declare a list and when I type "c." The drop-down list of available functions does not appear, is this normal? 

Where can I find the functions available for these lists?

By cons how can you have the length of a curve? Because the value of the domain does not give me the length.

"domain.T1" gives 27 and my length's curve is 24

The domain is not synonymous with length. Not only does the 'length' of the domain not necessarily correspond to the length of the curve, equal steps through the domain do not result in equally long steps along the curve.

The domain is a direct representation of the underlying mathematical equations of the curve. Length on the other hand must often be approximated iteratively. This is much slower than domain/parameter access, which is why almost all algorithms use domains. Human beings of course prefer to approach curves from a length-based perspective.

If you want to find which parameter corresponds with a specific length along the curve, you must use the Curve.NormalizedLengthParameter() method.

private void RunScript(Curve C, double L, ref object Pt, ref object Tn)
  double t;

  C.NormalizedLengthParameter(L, out t);
  Pt = C.PointAt(t);
  Tn = C.TangentAt(t);

Another small question (sorry):

Does a "flip" function for the curves (like the grasshopper component) exist in c# ? I didn't find

See the c# on your other discussion



Search Grasshopper


  • Add Photos
  • View All

© 2017   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service