When the distance between the red points and the point decreases, I want to reverse the vectors. The code does not fail but is not working. Can you help me?
import rhinoscriptsyntax as rs
red = rs.coerce3dpointlist(red_)
if distances < 8.00 : return
vector2 = rs.VectorReverse([1,0,0])
distance = redPt.DistanceTo(pt)
if distance > 8.00:
vector = -vector
a = vector
ReverseVector.gh (4.5 KB)
You define a function but do not call it so it does not execute. The function returns none for short distances and does not return anything otherwise.
The code outside the function can not access variables defined inside it : you have to return the value you are looking for.
Hope this helps
When I link the code to my model it gives this error. Is it because the points are moving?
Runtime error (MissingMemberException): ‘NoneType’ object has no attribute ‘DistanceTo’
line 1, in scriptFirst implicit Grasshopper cycle.
I guess I couldn’t fully understand what you mean.
I ran the code but now there is no change. When I move the red points, the direction of the vectors needs to change. Can I change the direction of the points in the simulation without connecting the vectors?
02.05.2020_Model.gh (25.3 KB) 02.05.2020_sena.3dm (2.2 MB)