algorithmic modeling for Rhino
a better question would be how do I factor a vector, so take a vector and multiply by itself a number of times. I tried vec=vector**4 but get
Runtime error (TypeErrorException): unsupported operand type(s) for **: 'Vector3d' and 'int'
The correct syntax is using just one *. Like so:
import Rhino as rc
myVec = rc.Geometry.Vector3d(0,0,1)
myVec = myVec * 2
print myVec.Length
Or:
import Rhino as rc
myVec = rc.Geometry.Vector3d(0,0,1)
myVec *= 2
print myVec.Length
You also can add, subtract etc. using mathematical operators (+,- etc.). You can read more about this in the RhinoCommon SDK.
Thanks naruto that is really helpful. I will study it! I worked around the issue by using a for loop. I am trying to dig deeper in to looping and working with python. After scaling the vector i am trying to say, iterate through this vector by increasing scale until the distance is greater than a number... then choose the one just below that... I have it almost working but not sure how to nest an if in a for loop to say if this is condition is met stop the loop... Thanks!
import rhinoscriptsyntax as rs
list = []
for num in range (number):
m = rs.MoveObject(x,y)
pt2 = rs.CurveStartPoint(x)
dist = rs.Distance(pt,pt2)
list.append(m)
if dist < 30:
return
a = lis
thanks for your help. I'm also curious why this list num slider doesn't seem to affect the output. i thought it worked like list item where i could choose which item in the list i want...? Thanks so much
Hi Ethan
Check the attached file
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by