Grasshopper

algorithmic modeling for Rhino

GeometryBase.Rotate Method returns a boolean instead of a geometry?

Hi guys,

I was looking at the Rotate method for a curve (GeometryBase.Rotate Method) in the Rhino Common SDK and noticed that it returns a boolean value, why doesn't it return a curve or any rotated geometry instead?

Many thanks,

Arthur

Views: 1072

Replies to This Discussion

Hi Arthur, 

because it rotates the object you call it on. 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thank you very much David. I asked this questions as I have tried several ways to rotate a curve and found out that only one worked:

    Dim newcrv As Curve
    newcrv = x.DuplicateCurve()
    newcrv.Rotate(z, y, x.PointAtEnd)
    A = newcrv

Whereas the following one returned a "true" instead of a curve:

   A = x.Rotate(z, y, x.PointAtEnd)

Not sure I fully understand why this is as in the second case I am also calling the mehod on the curve x?

Sorry I got it now...

Instead of A = x.Rotate(z, y, x.PointAtEnd)

I need:

A = x

It makes sense, we are returning the curve not the method...

crv.Rotate(RhinoMath.ToRadians(45), Vector3d.ZAxis, Point3d.Origin)
A = crv

This works for me, I don't have to duplicate the curve first. Rotate() always returns a Boolean value so A = x.Rotate(z, y, x.PointAtEnd) would always result in A being either True or False.


--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks David. It makes sense.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service