Script generates duplicate objects

Hi all-
I quickly whipped up this script to run unrollSrf on multiple objects. Got the job done but rs.UnrollSurface creates geometry that I have to manually delete after moving. Also the explode=False switch didn’t seem to work for me, which is why I had to run JoinSurfaces.

Does one have to create geometry, move it, then delete the originals?

Does this make sense?

thanks for your help

import rhinoscriptsyntax as rs

polySrf = rs.GetObjects("Select polysurfaces to unroll", preselect=True)
xMove = 0

for i in polySrf:
    x = rs.JoinSurfaces(rs.UnrollSurface(i))
    rs.MoveObject(x,((xMove,-100,0)))
    xMove += 80
 

First, I wouldn’t nest functions like this

rs.JoinSurfaces(rs.UnrollSurface(i))

It’s just going to add to the confusion and make debugging difficult.

Second, rs.JoinSurfaces() has an optional argument to delete the originals or not. If you don’t supply it, it defaults to not deleting the originals, which is probably what you’re seeing. Check the rhinoscript help to see all the optional arguments - also in UnrollSurfaces().

–Mitch