+ Reply to Thread
Results 1 to 3 of 3

Thread: RhinoCommon: expected IEnumerable[Brep], got list ?

  1. #1
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    288

    RhinoCommon: expected IEnumerable[Brep], got list ?

    Hi all,

    Trying to use Rhino.Geometry.Brep.JoinBreps to join a set of Breps (which are joinable)

    python Code:
      #srfColl is a list of Breps
      tol=rs.UnitAbsoluteTolerance
      joined=Rhino.Geometry.Brep.JoinBreps(srfColl,tol)
    It errors out at the joined= line, I get the following message:
    Message: expected IEnumerable[Brep], got list

    In the SDK it says:
    Parameters
    brepsToJoin
    Type: System.Collections.Generic.IEnumerable(Brep)
    A list, an array or any enumerable set of breps to join.

    What am I not understanding here?
    Thanks, --Mitch
    Attached Images
    Last edited by Mitch; 07-07-2012 at 03:41 PM. Reason: added image

  2. #2
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    288
    Never mind - it was erroring out with the tolerance, not with the list, forgot the (). Funny error message for that...

  3. #3
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,464
    Blog Entries
    19
    My guess is that python just got completely confused with the parameters since tolerance was referring to a function definition. I created a test to make sure everything is working as expected and it looks like all is good

    Python Code:
      import scriptcontext
      from Rhino.Geometry import *
       
      pla = PlaneSurface(Plane.WorldXY, Interval(0,1), Interval(0,1))
      a = pla.ToBrep()
      plb = PlaneSurface(Plane.WorldXY, Interval(1,2), Interval(0,1))
      b = plb.ToBrep()
      plc = PlaneSurface(Plane.WorldXY, Interval(0,1), Interval(1,2))
      c = plc.ToBrep()
       
      brep_list = [a,b,c]
      breps = Brep.JoinBreps(brep_list, 0.01)
      if breps:
          for brep in breps: scriptcontext.doc.Objects.AddBrep(brep)
          scriptcontext.doc.Views.Redraw()

+ 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