+ Reply to Thread
Results 1 to 2 of 2

Thread: rs.LInearDimension bug or my fault?

  1. #1

    rs.LInearDimension bug or my fault?

    Hi Steve
    With this script I expect the result of attached picture LinearDimension_2 and not LinearDimension_1;
    It's a bug or my fault?
    Python Code:
      import rhinoscriptsyntax as rs
      p1=(-30,0,0)
      p3=(120,50,0)
      p4=(0,100,0)
      px=(60,120,0)
      py=(-50,50,0)
      rs.AddLinearDimension(p3,p4,px)
      rs.AddLinearDimension(p1,p4,py)
    Ciao Vittorio
    Attached Images

  2. #2
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    285
    Ciao Vittorio,
    Yes, this does seem to be buggy. As a matter of fact, rs.AddLinearDimension seems to be lacking two arguments that its vb counterpart has - a plane and also the dimension style.
    In testing, the plane argument is important, as the aligned dimension appears to always follow the X axis vector of the plane, and by default the World X axis. Have a look at the following vbRhinoscript:
    vb Code:
      Option Explicit
      Call TestAddDim()
      Sub TestAddDim()
          Dim p1,p3,p4,px,py,plane
          p1 = Array(-30,0, 0)
          p3 = Array(120,50, 0)
          p4 = Array(0,100, 0)
          px = Array(60,120, 0)
          py = Array(-50,50, 0)
          plane = Rhino.WorldXYPlane 
          Call Rhino.AddLinearDimension(plane,p3,p4,px)
          plane = Rhino.RotatePlane(plane, 90, Array(0, 0, 1))
          Call Rhino.AddLinearDimension(plane, p1, p4, py)
      End Sub
    Note that I had to rotate the plane 90° to get the second dimension right (try commenting that line out).
    Although in RhinoCommon the class Rhino.Geometry.LinearDimension has a plane argument, I don't see a method that uses the plane. The method called by rs.AddLinearDimension - Rhino.Geometry.LinearDimension.FromPoints(start, end, onpoint) does not have a plane argument...

    Also Steve, the Python Help page for Dimensions is missing both AddLinear and AddAligned methods (their individual pages exist and can be accessed from the tree view though)
    Cheers, --Mitch
    Last edited by Mitch; 10-07-2012 at 08:36 AM.

+ 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