Any reason why
DynamoNodes.Document.CurrentLayer doesn’t provide output?
I don’t know the reason, but you can use the LinkDWG-package if you need the layer names as an output
Its a method but you’re calling like a property.
This will work.
But it is better to use it as method. You can convert any Node to Code and see how the Node is written as code.
Just want to add some information about Document Current. If you update your current layer, the code block won’t update unless you change something. I recommend something like the attached DYN or refer to the animated gif to add the reset button.
Sample: DocCurrent.dyn (13.5 KB)
A reset can also be added to a single line of design script. Haven’t tested in D4C3D, but something like the code below will force a refresh of the current document. Similar results can be obtained for other functions like the layer. Basically it’s building the if statement in the same function that pulls the document. You can also use a definition and change the variable input as well (ie define curDoc(int) to return the current document, and each time the variable is changed your current document will refresh).
doc = resetValue ? Document.Current : Document.Current;
I’ve adjusted for a trigger like this now and that works perfect. Although I would like to know if an automatic update could be created without a manual trigger?
Automatic is tough - the node has to be marked as ‘dirty’ to know it needs to update. There aren’t many good ways to do this which won’t draw excess compute - usually it’s beat to figure out why you need that to change and revamp the workflow to do all the layers for all the things at once, or use Dynamo Player to ‘run when you want it to’.
One means of forcing an update is to use a Datetime.Now node and set your graph to a periodic run method. Be sure that the period is greater than your longest run time, use the output of the DateTime.Now to trigger the document.current node as needing a recalculation.