Grasshopper

algorithmic modeling for Rhino

I wonder what the correct way to translate a curve in a VB RhinoCommon component might be. For translation of a point, I use the following code. But it does not work for polylines and other curves. Do you have any sugestions?

 

Thanks in advance,

 

Jonatan

 

    Dim Pt As New Point3d
    pt.X = 0
    pt.Y = 0
    pt.Z = 0

    Dim ZDir As New Vector3d

    ZDir.X = 0
    ZDir.y = 0
    ZDir.z = 10

    Dim Move As New Rhino.Geometry.Transform
    move = rhino.Geometry.Transform.Translation(ZDir)

    Dim NewPt As New Point3d
    newpt = move * pt ''this will create a new point at 0,0,10

Views: 1068

Replies to This Discussion

crv.Transform(Transform.Translation(ZDir))

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

That works great. Thank you David.

question.

in C#

if i have a Line called "aLine" and i want to translate it along a Vector called "vect"

would i write it as such?

aLine.Transform(Transform.Translate(vect));     ?

because this is just returning a boolean true value?

It returns a boolean, and the aLine is actually changed. So yes, this is the correct way to write this. If you don't want to change aLine and instead get another line, then the syntax should be:

Line aLine = ...;

Line bLine = aLine; // Lines are structs, so this copies the line.

bLine.Transform(Transform.Translate(vect));

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service