Need help to debug Python script!

Hi all, I’m urgently trying to debug this script that was passed to me, I keep encountering these errors:

Message: Parameter must be a Guid or string representing a Guid

Traceback:
line 890, in coerceguid, “C:\Users…\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py”
line 1062, in coercerhinoobject, “C:\Users…\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py”
line 901, in ObjectLayer, “C:\Users…\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py”
line 623, in , “…\Question01_PY.py”

Does anyone have any ideas why and how I can fix it?

Rhino file: Upload files for free - Question01_PY.3dm - ufile.io
Python file: Upload files for free - Question01_PY.py - ufile.io

Thank you!

First I commented out all the unused imports in your script.

If you look at your error message, it references line # 623

The variable final is None because the call to rs.BooleanDifference(box2,bOff2) is failing.

If you trace back the code that creates box2 and bOff2 geometry to this point:

rect is shown here in blue and off is shown in red:

The red off polycurve is the base used to generate the bOff2 object that is causing the BooleanDifference to fail.

I replaced the code at line # 569 with this (using the same logic that is used to create the rect curve to create the off curve):

The code now works as expected producing this output:

Question01_PY_re.py (17.9 KB)

-Kevin

You could simplify your code and possibly speed it up by using the vector math operations provided in the RhinoScriptSyntax and/or RhinoCommon libraries instead of the custom class in your script.

-Kevin