+ Reply to Thread
Results 1 to 3 of 3

Thread: Problem with MeshPolyline

  1. #1

    Problem with MeshPolyline

    Hi,

    please find attached an example file for the following script:

    python Code:
      import rhinoscriptsyntax as rs
      import scriptcontext
      import Rhino
       
      def Start():
         
          crv_id = rs.GetObject("Get Curve", rs.filter.curve)
         
          test1 = rs.IsCurvePlanar(crv_id)
          test2 = rs.IsCurveClosed(crv_id)
          test3 = rs.IsCurveClosable(crv_id)
          test4 = rs.IsPolyline(crv_id)     
          mesh_id = rs.MeshPolyline(crv_id)
         
          print test1, test2, test3, test4
          print mesh_id
         
          return
       
      Start()

    The script works with the green curve, but not with the red curve. For some reason Rhino.Geometry.Mesh.CreateFromClosedPolyline(polyl ine) returns None in this case. I was wondering what is causing this behaviour.


    The Rhino Command "MeshPolyline" however works.
    - Martin
    Attached Files

  2. #2
    Hi Martin,
    Is it possibe that you have some dupliacte points in your polyline?
    does this work?

    Python Code:
      import rhinoscriptsyntax as rs
      import scriptcontext
      import Rhino
       
      def Start():
         
          crv_id = rs.GetObject("Get Curve", rs.filter.curve)
         
          test1 = rs.IsCurvePlanar(crv_id)
          test2 = rs.IsCurveClosed(crv_id)
          test3 = rs.IsCurveClosable(crv_id)
          test4 = rs.IsPolyline(crv_id)
          pts = rs.CurvePoints(crv_id)
          pts = rs.CullDuplicatePoints(pts,0.1)
          pts = list(pts)
          pts += [pts[0]] # to make start and end point the same, since this duplicate was removed too
          poly =rs.AddPolyline(pts)
          mesh_id = rs.MeshPolyline(poly)
       
         
          print test1, test2, test3, test4
          print mesh_id
         
          return
       
      Start()

  3. #3
    Hi Goswin,

    yes, it worked. Great! Thanks.

    - Martin

+ 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