+ Reply to Thread
Results 1 to 5 of 5

Thread: RotatePlane - works for radians, but not degrees

  1. #1

    RotatePlane - works for radians, but not degrees

    Hi Steve,

    Not sure if this is intended or not. This works as expected:
    rs.RotatePlane(thisCPlane, (math.pi/4), thisCPlane.Xaxis)

    but this doesn't:
    rs.RotatePlane(thisCPlane, 45, thisCPlane.Xaxis)

    Python Code:
      import rhinoscriptsyntax as rs
      import math
       
      thisView = rs.CurrentView()                                     
      thisCPlane = rs.ViewCPlane(thisView, None)
      thisCPlaneName = 'TempCPlane'
      rs.AddNamedCPlane(thisCPlaneName, thisView)
       
      rs.RotatePlane(thisCPlane, 45, thisCPlane.Xaxis)
      rs.ViewCPlane( thisView, thisCPlane )
       
      circle_1 = rs.AddCircle(thisCPlane, 18)
      object = rs.AddSphere(thisCPlane, 20)
       
      bbox_world = rs.BoundingBox(object, thisView, True)
      box_world = rs.AddBox (bbox_world)
       
      bbox_cplane = rs.BoundingBox(object, thisView, False)
      box_cplane = rs.AddBox (bbox_cplane)
       
      rs.RestoreNamedCPlane ( thisCPlaneName, thisView )
      rs.DeleteNamedCPlane ( thisCPlaneName )

  2. #2

    Rotate CPlane and BoundingBox

    Hi Steve,

    Also, there still seems to be a bug in making a BoundingBox with construction plane coordinates. Have a look at the following code. You might need to test it on an object that doesn't fit in a cube to see what I mean.

    It could be syntactical on my part, or something to do with the way python is referencing objects... but it seems to be making a bounding box based on world coordinates then remapping it to the cplane?

    Thanks for checking it out,
    Rob


    Python Code:
      import rhinoscriptsyntax as rs
      import math
       
      object = rs.GetObject('choose a object to test')
       
      thisView = rs.CurrentView()
      thisCPlane = rs.ViewCPlane(thisView, None)
      thisCPlaneName = 'TempCPlane'
      rs.AddNamedCPlane(thisCPlaneName, thisView)                     
       
      rs.RotatePlane(thisCPlane, (math.pi/4), thisCPlane.Xaxis)
      rs.ViewCPlane( thisView, thisCPlane )                         
       
      bbox_cplane = rs.BoundingBox(object, thisView, False)           
      box_cplane = rs.AddBox (bbox_cplane)
       
      rs.RestoreNamedCPlane ( thisCPlaneName, thisView )
      rs.DeleteNamedCPlane ( thisCPlaneName )

  3. #3
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,464
    Blog Entries
    19
    Hi Rob,
    You're right, the function should be working with angles in degrees. I just posted a fix at
    http://code.google.com/p/rhinopython...cript/plane.py

    Thanks,
    -Steve

  4. #4
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,464
    Blog Entries
    19
    Hi Rob,
    I see the problem. Unfortunately this fix will have to wait until the next WIP because I had to make some changes to the RhinoCommon SDK compiled code.
    Thanks,
    -Steve

  5. #5
    Great - thanks for checking it out and look forward to the update.
    Cheers,
    Rob

+ 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