Grasshopper

algorithmic modeling for Rhino

import Rhino as r
import math

L=[]
linesseg=r.Geometry.Polyline.GetSegments(polyline)
for line in linesseg:
startpt=r.Geometry.Line.PointAt(line,0)
Zstartpt=r.Geometry.Point3d(startpt[0],startpt[1],5)
Zvector=Zstartpt-startpt
endpt=r.Geometry.Line.PointAt(line,1)
vector=endpt-startpt
vector1=r.Geometry.Vector3d.Rotate(vector,math.radians(90),Zvector)
midpt=r.Geometry.Line.PointAt(line,0.5)
r.Geometry.Transform()
# i wanna move the midpt alone the vector1, i couldnt find the related method.
#Thank you

-Carcassi

Views: 3067

Replies to This Discussion

wouldn't adding the point and the move vector together equate to the new point location

how to get the point i want?

import Rhino as rc

# moving vector and base point

movingVector = rc.Geometry.Vector3d(10,10,10)

point = rc.Geometry.Point3d.Origin

# probably you are looking for something like this

newPt = rc.Geometry.Point3d.Add(point, movingVector)
print newPt

# or as Danny mentioned simply add them up

newPt2 = point + movingVector
print newPt2

dunno how it works in python but there is also another method in vb, which is something like :

Dim pt As New point3d(0, 1, 2)

Dim vec As New vector3d(1, 1, 1)

Dim tr As New rhino.geometry.transform

tr = rhino.geometry.Transform.Translation(vec)

pt.transform(tr)

Yea, it's a slightly complicated method... but it gives an opportunity to work with tranformation matrices.

i am pythoner,still thanks.

Thanks

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