JoinSurfaces() creating an invalid object from valid surfaces?

Hi, I have a surface and a polysurface, and when I call rs.JoinSurfaces() as below, the resulting object fails the IsObjectValid() check. When I join the same two surfaces interactively via _Join, the resulting object checks out ok. As you can see below, the input objects seems to be valid. Any idea what the problem could be?

assert rs.IsObjectValid(news)
assert rs.IsObjectValid(lowerSurfaceId)
assert rs.IsSurface(lowerSurfaceId)
assert rs.IsPolysurface(news)
cupobj = rs.JoinSurfaces((lowerSurfaceId, news), delete_input=True)
assert cupobj
assert rs.IsObjectSolid(cupobj)
assert rs.IsPolysurface(cupobj)
assert rs.IsPolysurfaceClosed(cupobj)
assert rs.IsObjectValid(cupobj)    # <-------- THIS CHECK FAILS

And when I interactively check the resulting invalid object it says:

  Rhino polysurface object is not valid.
  
  ON_ArcCurve m_arc is not valid
  ON_Brep.m_C3[11] is invalid.

Any suggestions?
Thanks,
Josh

Hi Josh
Just because input surfaces and polysurfaces are valid, does not mean they can join.
Did you try to join your geometry using a Rhino command? Does it work? Also, can you share the example with the surfaces?

I did try to join using the _Join rhino command. And yes it did work and produced a closed polysurface that is valid. So it seems like the _Join rhino command is producing a valid surface where as the python rs.JoinSurfaces() is producing an invalid surface. Any idea why _Join is succeeding where rs.JoinSurfaces() is failing?

I’ll work on getting a version of the surfaces I can post.
Thanks,
Josh

Can you please share the surfaces as a .3dm file?

When I was preparing the 3dm file I figured out an answer. One of the surfaces that I was joining was created by revolving a planar open polycurve around the y axis. The problem was that a middle segment of the curve was along the y-axis. So the revolution created a single surface when in fact what I’d meant to create was two surfaces, one for either end segments of the polycurve. So the fix was to delete the segment along the y-axis, making the open polycurve into two curves, and revolving each separately to create the two surfaces.
Josh