Forgot password?

Create an account!

Forum

« back

RhinoScript – Plane Best Fit Through Points

Messages

Please log in to write a message.

  • 5. geef (Nov 16, 2011 13.15):

    ok found it ;-)
    thanks again for quick reply!

  • 4. geef (Nov 16, 2011 12.51):

    hi again,

    are you using rhino5?
    I have the latest SR (SR9) installed but I don't have the method Rhino.PlaneFitFromPoints available...

  • 3. geef (Nov 16, 2011 12.40):

    hi,

    thanks!
    I don't have that in my rhinoscript helpfile.

  • 2. Johannes (Nov 16, 2011 10.39):

    hi

    here the rhinoscript help file example:

            Dim arrPoints, arrPlane, dblDX, dblDY

            arrPoints = Rhino.GetPoints(,,"Pick some points")

            If IsArray(arrPoints) Then

                    arrPlane = Rhino.PlaneFitFromPoints(arrPoints)

                    If IsArray(arrPlane) Then

                            dblDX = 20
                            dblDY = 20

                            Call Rhino.AddPlaneSurface(arrPlane, dblDX, dblDY)

                    End If

            End If

    johannes

  • 1. geef (Nov 16, 2011 10.34):

    Hi,

    I need to do something like the PlaneFit Component in Grasshopper.
    Given any number of points I won't to get the plane with minimum square distance to through the points. I found one example but this is for RhinoPhython. Anyone know how to do that in Rhinoscript?

    def PlaneFitFromPoints(points):
      """
      Returns a plane that was fit through an array of 3-D points.
      Parameters:
      points = An array of 3-D points.
      Returns:
        The plane if successful
        None if not successful, or on error.
      "
    ""
      points = rhutil.coerce3dpointlist(points)
      if (points == None): return scriptcontext.errorhandler()
      rc = Rhino.Geometry.Plane.FitPlaneToPoints(points)
      if (rc[0] == Rhino.Geometry.PlaneFitResult.Success):
        return rc[1]
      return None

    Thanks for your help!

Recommend

Why are these buttons gray?