Forgot password?

Create an account!


« back

RhinoScript – Select real number instead of point in Rhino.Command


Please log in to write a message.

  • 2. Johannes (Apr 07, 2010 16.28):

    here is a way to work without rhino commands... you can pick every point on a surface and you will get a line in normal direction with a specified length.
    this script works on every surface (in normal direction):

    Option Explicit

    Call SrfNormal()
    Sub SrfNormal()
    ' input paramter
    Dim strSrf      : strSrf = Rhino.GetObject("pick srf", 8+16)
    Dim strPt       : strPt = Rhino.GetPointOnSurface(strSrf, "pick point on surface")
    Dim dblLeng     : dblLeng = Rhino.GetReal("length of normal curve", 15)
    ' change 3dPoint to UVCoordinates
    Dim dblPar      : dblPar = Rhino.SurfaceClosestPoint(strSrf, strPt)  
    ' zero based normal vector at UVCoordinates
    Dim vNormal     : vNormal = Rhino.SurfaceNormal(strSrf, dblPar)
    ' scaled vector
    vNormal = Rhino.VectorScale(vNormal, dblLeng)
    ' 2nd point
    Dim strPt2      : strPt2 = Rhino.VectorAdd(strPt, vNormal)
    ' line between 1st and 2nd point
    Dim strLine     : strLine = Rhino.AddLine(strPt, strPt2)

    End Sub
  • 1. mrgordon (Apr 07, 2010 03.37):

    I am trying to find a normal line. It seems like the easiest way is to use the _Line command line method. I managed to get the following snippet to work:

    Dim strCommand : strCommand="_Line _Normal -_SelSrf " & strSurface & " -_SelPt " & pt2str(Rhino.SurfaceAreaCentroid(strSurface)(0)) & " -_SelPt 500,500,500 _Enter"
    Rhino.Command strCommand, 0

    I know that the _Line function can take either an end point or a distance for the last value. How could I modify my code to specify a distance instead of a point where I say "-_SelPt 500,500,500". I've tried just putting a number but then the function doesn't appear to work at all.


Why are these buttons gray?