If I use the node CurrentLayer, it takes the value from the drawing at that moment. Changing it will not update the script (while other nodes do like selecting objects from a layer). If I place a new node CurrentLayer, I have different values in the nodes.
Is there a reason why this node is not updated to the expected value?
I believe that node doesnât update without forcing a toggle. I think this is by design but @Frank_Huang can confirm.
I believe that a work-around is to place a dummy if statement toggle before it, using Design Script because why get complicated. Let me know if this doesnât work in a code block, where the output goes into the Document.CurrentLayer node.
Toggle ? Doc : Doc
The âtoggleâ input should be wired to a Boolean node. The Doc input to the Document.Current node.
Any flip of the toggle switch will update everything down stream, despite the fact that nothing new has been passed along (both the true and the false pass the same data, but Dynamo doesnât know that).
The âRun Previewâ feature is a great way to visualize this.
@jacob.small @Anton_Huizinga you are right. we didnât force it to update. in Automatic mode, reconnect the document input, it will update to the right value. This is as designed at this moment.
if you have any thought on the impact of this behavior, let me know.
Thanks,
Frank
It does not have much impact, Most people will just run a script and not switch layers while in script mode.
If it can be changed in the future to the expected output (or change the description to âCurrent when connectedâ ) Iâll be happy. On the other hand, other nodes also not change (math.random) so Iâm not sure what is the best.
The toggle switch works great, maybe there are other solutions (i.e. activating the script editor, can that be accessed with DS?) else the true/false switch is a good option to trigger static functions.
1 Like