Unable to convert surfaces into breps

I’m doing the tutorials at thinkparametric.com, and I’m having a problem with part 6 of the Waffle Structure tutorial.

In it, you have a bunch of surfaces that you convert to breps, using a script. This is the script.

When trying to execute the script the first time, I get the following error:

Message: unable to convert [, ] into Brep geometry Traceback: line 553, in coercebrep, “C:\Users\Robin\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py” line 16, in , “C:\Users\Robin\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts\waffle_script.py” line 995, in IntersectBreps, “C:\Users\Robin\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\surface.py”

I’ve removed all non-surface objects from the layers; when I select the objects in the layers, there are only surfaces. What is going wrong?

Here is the model and this is the grasshopper definition.

In your script the failing line 16 is:

int_line = rs.IntersectBreps(ribs_1[i],ribs_2[j])

The error message complains about trying to convert [, ] Is it possible that ribs_1[i],ribs_2[i] both do not exist for some i,j?
Have you tried printing out something about them just before this call to IntersectBreps?

Thanks for your reply Terry!

I’m not sure what you mean by ribs_1[i],ribs_2[j] not existing for some i,j, because what the script does is go through all the ribs_1[i] that you select and try to intersect them with all the ribs_2[j] that you select. Since you select the ribs, they must all exist, right?

I tried editing the script to see if there were any non-surfaces. This is the script I used, but it looks like there were 400 surfaces.

Looks like a reasonable script to check out whether the ribs are there.

But I think it would be better to do this print inside the original script so you can see what i and j it is failing on. The error message says something is amiss somewhere along the way. Lots of times my scripts do not work and it can take me some time to find the problem. But usually the error message is helping to point me to the solution even though some of them can seem pretty cryptic. The harder cases are where I get no message.

I did some more debugging on the script. Turns out I just forgot to add [0] to line 33!