Jump to content
Sign in to follow this  

Set Layer Node

Recommended Posts

I'm having trouble with the "Set Layer" node, it never populates its list of the design layers in my document. I've attached a picture of my small example where my design layers are "Original" and "Transferred Here" but in the properties for the node my options are "Design Layer-1" and "Ham".

  • Does anyone have insight on how this node is supposed to function?
  • Also does anyone know how I can send an object to another design layer with marionette?

Share this post

Link to post

I think there are issues with the Set Layer node...

(Okay, I know there are... and I have NO IDEA where Ham is coming from.)

Give me a bit and I'll give you a working example on how to change an object's layer.

Share this post

Link to post

Before I do that, do me a favor.

Double click on the "Set Layer" node and enter the Script Editor window. Without changing anything, exit out of that, deselect the Set Layer node, and select it again.

Does that update the list of popups?

Just trying to troubleshoot.

Share this post

Link to post

Here's a file with a node that you can use as an alternative. The downside is that you will have to type in the name of the layer that you want to move your object to in the String node.

This will be the most reliable method for the time being. I know why the current version doesn't work, but I'm not sure how we'll be able to dynamically update the layers that show - the only way right now would be to edit the script in that node, as I've stated in my previous post.

Share this post

Link to post

I tried that and no change to the list of popups. I went one further and added #test as the last line of the node and saved it to see if that would refresh it, no luck.

Share this post

Link to post

That worked! So the band-aid fix is to add and remove that line each time I need to populate this list? I think I can make that work.

Share this post

Link to post

For now, that's probably your best bet, aside from using the node in the file I posted earlier in this thread :)

Glad it worked.

I'll work with the people who work on the back end to see if we can get this to behave better.

Share this post

Link to post

Hello Brendan - There is a way to make the Set Layer node work. First you must RUN it on its own, then double click to open the script window, close window, deselect, and select again.

The logic behind this is that the node doesn't recognize the layers in the document until it is run, and then it can't transfer them to the drop down menu until the script editor has been opened. If you add layers to your document after you add this node, just run it again and open and close the script window.

Share this post

Link to post

Hi Marissa,

This node is kind of danger since it creates a duplicate of the obj and deletes the original.

Here is an alternative:

class Params(metaclass = Marionette.OrderedClass):
this = Marionette.Node( "Set Layer" )
this.SetDescription( 'Adds an object to a specified layer' )
object = Marionette.PortIn(vs.Handle(0), 'obj')
object.SetDescription( "The input object" )

layer_name = Marionette.PortIn( None )
layer_name.SetDescription( "Name of the layer." )

obj = Marionette.PortOut()
obj.SetDescription( "The result object" )

def RunNode(self):
obj = self.Params.object.value
layer_name = self.Params.layer_name.value

# Creates the layer if it not alreay exists
vs.Layer (layer_name)

# Get the handle to the layer
lay_h = vs.GetLayerByName (layer_name)

vs.SetParent (obj, lay_h)	

self.Params.obj.value = obj

Edited by Patrick Winkler

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...