Rhino Python Script Only Works with Breakpoints

Hello! I’m encountering a strange bug that gets solved as soon as I insert a breakpoint into my script. This is along script with many functions so I will only post screenshots of the relevant sections. The failure in the command involved the creation of layers.

The command script is Door_V22TRV_cmd.py

I am importing these packages/calling functions from these scripts:

The highlighted variables are the layers that are created/called by the functions.

The definition of the layer variables in the GetInputs() function is here:
And these are returned here:

These layers are then used as inputs for the various Door functions (WeathertightDoor() etc). The layer creation portion of these functions are all identical so for the purposes of this topic we will look in the JoinerDoor() function.

Layers are created here:

And one layer is returned here:

When the command is run normally the layers are all created disregarding the parent layers called within the rs.AddLayer() functions

However, if a breakpoint is inserted at any line in the script, for example here:

The layers are created as defined in the script!

I made no other changes to the script or any functions. I have tried to replicate the pause created by the breakpoint with a time.sleep() function of up to 30 seconds, but this did not work. I have updated to the latest version of Rhino 7.

Thank you in advance for your time and help!

Jamie S. Demers

1 Like

Looks like it is similar to this Paren Layer Bug discussion:

just guessing:

did you try the rhinoscript-sleep ?

there is also a
(that seams to be called in the background of rs.Sleep() see here )

This has been solved! As the link that @jcparks touches on, there’s a bug with the "parent = " input to the rs.AddLayer() function. I worked around that by adding layers without a parent layer specified and then specifying the parent layer with rs.ParentLayer() in the next line. This had a couple knock on effects related to calling the layers later on but that was all solvable.

Thanks @jcparks and @Tom_P for the replies!

1 Like