today I updated to SR12(5.12.50810.13095, 10.08.2015) - 64bit.
Now adding a childlayer under a parent layer using pyhton script does not work any more.
Above code results in two layers: “MyLayer3” and “MyLayer4” without childs.
Using rhinoscript adding a childlayer still works.
That causes big trouble to me because I have nearly hundred scripts here at work that rely on childlayers…
On another computer yesterday I had the same issue after updating - but now it works again. Don’t know why.
Does anyone have the same problem?
Please help!
I can’t duplicate that and the rs.AddLayer function hasn’t changed between sr11 and sr12.
Do you still have the problem if you run the script on a new file?
The computer where your script works has the exact same version of Rhino as the one where the script doesn’t work?
Do you mind doing the following 2 things?
can you upload the layer.py file from the C:\Users\%USERPROFILE%\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript
directory?
can you upload the new .3dm file with the 2 layers added?
I’m not sure what I’m looking for … I hope this will give me clues.
Yes it is exactly the same version. But on the other computer it still does not work allways. Sometimes it works on a new file sometimes not. It’s really strange.
Sorry for sending twice - fist time I uploaded something.
Update: Now I was also able on my computer to open a document in rhino were adding layers using parent layers does work. But it is still not working on new empty documents.
While working I realized, that the behaviour changes from time to time also in an opened document without closing and opening it. So if it works - after a while it does not work any more and vice versa.
Actually if the original script is failing I was expecting this to fail as well. That failure would have hopefully provided some insight. You said it doesn’t always fail so maybe this was one of the lucky times. It crossed my mind that it might have something to do with running a French version but that seems far fetched. There’s something I’m not seeing …
Yes the two scripts seem to do the same thing. But the second script always works - also if the first one fails. I tried it several times when the first script was not working. The first script keeps failing the second one always does right. I am on a german system - maybe that is important.
btw, I thought it was a stretch to think that the problem was linked to running an non-english version of Rhino but since I don’t see what else could be different I installed a German version of Rhino and I still can’t duplicate the problem.
We are using Windows 7. But I guess you too. On both computers where I updated Rhino to SR12 we got that problem. I stopped updating the 5 remaining computers yesterday because I am afraid it will be same there then. Is there maybe a communication progress between Python/Rhino and something else that could be blocked by a software we have installed? - but I think that would cause an error message.
Is there a way to downgrade to SR11 in case of emergency?
Or maybe I could change the script in layer.py so it works the way your second script does - but that seems dangerous to me.
Did you look at layer.py on a computer still with SR 11 ?
I had layer.py open when Rhino updated to SR12. Then I reopened the file and … had the feeling it was different …
But obviously I can be wrong.
… Just an attempt …
On a german system, i get no error using either method, in SR11 and SR12. This may be a shot in the dark, @powerpp does the snippet below work any different ?
import rhinoscriptsyntax as rs
rs.AddLayer(“MyLayer3”)
rs.AddLayer(name=“MyLayer4”, parent=“MyLayer3”)