Forgot password?

Create an account!

Forum

« back

RhinoScript – Creating point cloud from surface using RhinoScript?

Messages

Please log in to write a message.

  • 2. Johannes (Nov 22, 2014 14.24):

    Hi, here is a quick script how to iterate through surface parameters (U and V).

    Johannes

    Call Main()
    Sub Main()
           
            ' input srf id
            Dim srfID       : srfID = Rhino.GetObject("Pick a srf", 8)
           
            ' input point count in U and V direction
            Dim countU      : countU = 8
            Dim countV      : countV = 12
           
            ' surface domain in U and V
            Dim srfDomainU  : srfDomainU = Rhino.SurfaceDomain(srfID, 0)
            Dim srfDomainV  : srfDomainV = Rhino.SurfaceDomain(srfID, 1)
           
            ' step size in U and V
            Dim stepU       : stepU = (srfDomainU(1) - srfDomainU(0)) / countU
            Dim stepV       : stepV = (srfDomainV(1) - srfDomainV(0)) / countV
           
            Dim pt, i, j, ptParam
           
            ' iterate through surface parameters
            For i = 0 To countU
                    For j = 0 To countV
                           ' point at surface parameter
                            ptParam = array(i * stepU + srfDomainU(0), j * stepV + srfDomainV(0))
                            pt = RHino.EvaluateSurface(srfID, ptParam)     
                            Call Rhino.AddPoint(pt)
                    Next
            Next
           
    End Sub
  • 1. Adam Persson (Nov 21, 2014 22.46):

    Hello,

    I would like to create a point cloud from a surface. This is then used as input into a simulation software. Now, manually I do this by first creating say 20 curves, perpendicular to the X-axis using the Contour-command. Then, 11 points are fitted to each curve with the Divide command. Now, the export of the manually created point cloud is currently done with RhinoScript and excel, but I have little success trying to automate the point cloud creation. I have tried to use the commands mentioned above with

    Rhino.Command

    but cannot figure out how to pass selected surfaces and curves to the commands. Do you have any suggestions how to do this?

    Best regards,
    Adam Persson

Recommend

Why are these buttons gray?