Forgot password?

Create an account!

Forum

« back

RhinoScript – Curve POLYsurface Intersection?

Messages

Please log in to write a message.

  • 6. BoundingBoxer (Jun 07, 2011 15.16):

    Thanks a lot!! This was the missing information !!!
    Now, I can go on to the next problems :-)

  • 5. ledisnomad (Jun 07, 2011 15.03):

    I often run into this kind of problem, where the manual doesn't actually say enough to tell me what is returned. CurveBrepIntersect returns an array with all the objects it created during the intersection. The curve could intersect the brep multiple times, so there may be a few points and/or curves that are created by the intersection. Each item in the array is one of these intersections.

    If you are sure you only have one point of intersection (which looks to be true from your UBound statement, and this is a quick script that you don't need to catch everything), then pnts(0) is the string identifier, not a 3-D point. So you just need one more method:

    yourPointIntersection = Rhino.PointCoordinates(pnts(0))

    This will give you a 3-D point, then you can use Pt2Str(yourPointIntersection) to print out the coordinates.

  • 4. BoundingBoxer (Jun 07, 2011 14.50):

    I also want to use CurveSurfaceIntersection and want to refer to the Object created. I want to print out the coordinates of the point that is the intersection of a trimmed surface and a curve (straight line).

    In the manual it is stated that an array of the string representations of the objects is returned.

    I cannot retrieve the data from the returned object. Perhaps has an RhinoScript expert a hint for me?? Thank you very much in advance!!

    My Test-Script:

    Option Explicit

    Call TestIntersect

    Sub TestIntersect
      Dim strModel
      Dim strCurve
      Dim pnts, point
     
      strModel = Rhino.GetObject("Select model", 24)
      strCurve = Rhino.AddCurve( Array(Array(1, 1, 0), Array(1, 1, 10)))
     
     
      ' Get the point on the curved surface of the model
      ' pntModel = CooIntersectionSurf( strCurve, strModel )
      pnts = Rhino.CurveBrepIntersect( strCurve, strModel )
      If IsArray( pnts ) Then
        Rhino.Print "we have an array!"
        Rhino.Print "upper bound of the array: " & UBound(pnts)
        Rhino.Print "The first array entry is ...." & pnts(0)
    ' next line generates error: Type mismatch in parameter. Array required
        Rhino.Print "Coordinates: " & Rhino.Pt2Str( pnts(0) )
    '    point = Rhino.ObjectsByName( pnts(0) )
           
      End If
    End Sub

    generates the output

    we have an array!
    upper bound of the array: 0
    The first array entry is ....835f0dd4-b8d0-441f-b861-def40db3dfcc
    [\code]

    and stops with an error
    ***"Type mismatch in parameter. Array required"*** in the line where Pt2Str is called.

    How can I refer to the created object???
  • 3. ledisnomad (May 23, 2011 20.43):

    Helps a lot! Thank you, Hanno. From the description, I saw that it works on trimmed surfaces, but didn't realize it works on polysurfaces, too. Excellent.

  • 2. Hanno (May 23, 2011 20.40):

    Hi,

    you are right about CurveSurfaceIntersection. This function works only on single surfaces and won't even respect trimming. In exchange, it gives you a lot of useful intersection information like curve/surface parameters.

    CurveBrepIntersect, on the other hand, does work with polysurfaces. This function actually creates rhino objects (points and curves) where intersections occur.

    Hope that helps!

    Hanno

  • 1. ledisnomad (May 20, 2011 18.15):

    Am I missing a method that will do an intersection with a curve and polysurface? When I use the intersect command, I get an intersection (at a point), but the CurveSurfaceIntersection() and CurveBrepIntersection() don't give me anything (because they only work with one surface/brep, right?).

    So, do I need to write my own CurvePolysurfaceIntersection() function or am I just missing something?

Recommend

Why are these buttons gray?