+ Reply to Thread
Results 1 to 2 of 2

Thread: Moving a curve along a vector

  1. #1

    Moving a curve along a vector

    Hi Everyone,

    I am struggling to move a curve along a vector. I am trying to move a curve .5" perpendicular to the surface. The result I keep generating moves it out into obscure space.

    I have attached the Rhino file and script to see if anyone can help.

    Thanks!

    -Andrew
    Attached Files

  2. #2
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    285
    Hi,

    I don't know exactly what it is you are trying to do, the method seems a bit complicated (especially the LineSphereIntersection part), but I can see where it's failing. Towards the end you have:
    python Code:
      int=rs.LineSphereIntersection(InnerNormal,Pt1,.5)
      print int
      Pt2=rs.AddPoint(int[0])
      V0=rs.VectorAdd(Pt0,Pt1)
      Move=rs.MoveObject(Offset0,V0)
    Note that you haven't actually defined Pt0, so it errors there. But the main thing is that you are using VectorAdd, but you should be using VectorCreate. VectorAdd adds two existing vectors, VectorCreate creates one vector from two points. Note that the "head" (arrow end) of the vector is specified first, this is backwards from what you might think. I don't know which direction you are trying to move your curves, so you may need reverse the order of the arguments in VectorCreate:
    python Code:
      V0=rs.VectorCreate(int[0],int[1])
      Move=rs.MoveObject(Offset0,V0)
    Now, there is something missing from Python rhinoscriptsyntax that is present in vb Rhinoscript - in the latter MoveObject will accept either a vector or 2 3D points, so the VectorCreate step is superfluous. Let's see if Steve can add this to Python.

    HTH, --Mitch

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts