Jump to content

Python: Delete node


morn66

Recommended Posts

Hi everyone,

I try to delete a node with a python script but it doesn't work.

In sop, I have a geo node name "deleteMePython". There is also another geo node call "pythonScript" that have a python node inside.

That's the script that I used on the python "node":

pythonNode = hou.node("/obj/deleteMePython")
pythonNode.destroy()

I attached the simple file to show you what is it.

Thanks :D 

pythonDelete.hiplc

Link to comment
Share on other sites

well that error suggests that you are deleting nodes by cooking things :P

I can understand if you write a shelf tool in python to do something like that,
or maybe a post-render script in a ROP node,
but I'm really curious what kind of thing you want to achieve with this,
as it indeed sounds like something that is not without risk

Link to comment
Share on other sites

Yeah I use 17.5.

What I want to achieve is to automatically create a subnet node with a bunch of node inside based on a folder directory and when created, the subnet has a specific name. So far, everything works well.

My only bug is that I want python to delete the subnet if it already exist before running the other script, because if I don't, the name of the new subnet will be "nameOfSubnet1" and I don't want that. I know that I can just delete the subnet before running my script, but I'm lazy and I want python to do it for me

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...