+ Reply to Thread
Results 1 to 2 of 2

Thread: bug in AddSweep2

  1. #1

    bug in AddSweep2

    Althought I'm giving the rails as a list, a exception is thrown saying: iteration over non-sequence of type Guid
    :
    Python Code:
      for u_cnt in range(len(u_plane)):
                  u_splt_srf = rs.SplitBrep(srf, u_plane[u_cnt])
                  rs.DeleteObject(u_splt_srf[1])
                  u_st = rs.SplitBrep(u_splt_srf[0], u_plane_sec[u_cnt])
                  u_crv_s2 = rs.DuplicateEdgeCurves(u_st[1])
                  rs.DeleteObject(u_crv_s2[1]) #delete extra curve
                  r1 = u_crv_s2[0]  #rail1 curve
                  if rs.CurveDirectionsMatch(r1, u_crv_s2[3]):
                      rs.ReverseCurve(u_crv_s2[3])
                  r2 = u_crv_s2[3] #rail2 curve
                  shape = u_crv_s2[3] #shape curve
                  rs.AddSweep2([r1, r2], shape)
    Last edited by Steve Baer; 06-20-2012 at 01:04 AM. Reason: fix python highlighting

  2. #2
    I have found the solution for the bug, it's problem was AddSweep2 expects 2 lists, so if you input just 1 shape curve, it will fail, even though you might just need one.
    You have to create a list out of shape curve(s), even though if you have only one shape curve.
    rails = [r1,r2]
    shape = [shape_curve]

    Code:
    def extrude_surfaces(self, u_strip, v_strip, mat_thick):
            for u_i in u_strip:
                edg = rs.DuplicateEdgeCurves(u_i)
                rs.DeleteObject(edg[2])
                r1 = edg[3]
                if not rs.CurveDirectionsMatch(r1, edg[0]):
                    rs.ReverseCurve(edg[0])
                r2 = edg[0]
                shape = edg[1]
                lst_rail = [r1, r2]
                lst_shape = [shape]
                rs.AddSweep2(lst_rail, lst_shape)

+ 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