Jump to content
Sign in to follow this  
Mikal

Copying Network Dots and other Network Items to Clipboard

Recommended Posts

Hi...

Am trying to automate the copying of a selection of nodes and dots to the clipboard..

If you copy these items manually using Ctrl-C then then it will correctly paste all the nodes and items together in the same network tree. 

Before network dots were introduced it was possible to do this in Python using:

hou.copyNodesToClipboard(hou.selectedNodes()) - however this doesn't include any items, so the dots aren't included and your network chain breaks if you paste this into your scene again.

It also doesn't seem possible to pass the items to the Clipboard with this function using: 

hou.copyNodesToClipboard(hou.selectedItems())  - returns a Type error.

So I was wondering if anyone else has encountered this issue, and if there's a function in HOM I'm missing, or a sensible workaround etc? Feels like if Ctrl-C works there should be something that can be done. 

Cheers

 

 

 

Edited by Mikal

Share this post


Link to post
Share on other sites

Hey man,

Did you try to use the node.copyItems ?

# Get all the selected nodes including dots
sel_items = hou.selectedItems()

# Get the node to copy the selected items to
copy_to_node = hou.node("/obj/geo1")

# To copy the selected items to your node
copy_to_node.copyItems(sel_items)

This should copy all the selected nodes including the dots on to whichever node you specify.

Hope this helps :)

Cheers

-J

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×