Hi,

Nothing wrong with the basic logic.
It is always good idea to add some print statements to debug values.
You'll see that your equation will always result in a range less that
temp_pt.x-10 and your resulting x is therefore uniform.

Here is a sample with slightly different equation (factor he Force)
and some print statement to show you how to debug.  I got some of
these points to move.

Good luck.


 ......
    For i = 0 To count
      V0 = A_pt1 - i_pts(i)
      V1 = A_pt2 - i_pts(i)

      If ( V0.Length() < V1.Length() )Then
        dis = i_pts(i).DistanceTo(A_pt1)
        V = V0
      Else
        dis = i_pts(i).DistanceTo(A_pt2)
        V = V1

      End If

      'Print your distance
      Print("Dis=" & dis)

      V.Unitize()
      V = V * (dis / 2) * Force 'You need to factor the Force

      temp_pt = i_pts(i)

      Dim range As Double
      range = -1 * V.x

      'Print range and temp_pt.x
      Print("Range(" & i & ")=" & range)
      Print("temp_pt.x(" & temp_pt.x)

      If range > (temp_pt.x + 10) Then
        temp_pt.x = (temp_pt.x + 10)
      Else
        If range < (temp_pt.x - 10) Then
          temp_pt.x = (temp_pt.x - 10)
        Else
          temp_pt.x = range
        End If
      End If

      'Print final temp_pt.x
      Print("temp_pt.x(" & temp_pt.x)

      new_pts.add(temp_pt)

    Next
.....



On Apr 14, 2:38 pm, LegoBuilder <[email protected]> wrote:
> can someone look at my files and tell me what i am doing wrong.
> i have a VB component that controls points in the Zaxis through
> attractor points. (which is working fine), then another VB component
> that controls the same points in the Yaxis. for some reason i
> cant get the Yaxis component to work like the other one.
>
> http://groups.google.com/group/grasshopper3d/web/rhionfile.3dm?hl=en
>
> http://groups.google.com/group/grasshopper3d/web/grasshopperfile.ghx?...
>
> regards

Reply via email to