Python SopVerb

   1438   3   1
User Avatar
Member
76 posts
Joined: March 2007
Offline
Hi there,

Is there any examples available of how to use a SopVerb in a Python Sop?

cheers,
benS
User Avatar
Member
76 posts
Joined: March 2007
Offline
I'm a little bit further. I've got some code that is executed and doesn't give an error
But I don't see any changes comming out of the Python Sop.
I would expect the carve with default parameters to cut something of my curve.

this is my code:

node = hou.pwd()
geo = node.geometry()

carve = hou.sopNodeTypeCategory().nodeVerb("carve")
geo.execute(carve)
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
try this:

node = hou.pwd()
geo = node.geometry()

carve = hou.sopNodeTypeCategory().nodeVerb("carve")
# when you use a sop as a verb you have to set the parameters
carve.setParms({'domainu1' : 0.25 })
geo.execute(carve, [])

# and write the geometry back to the node's geometry
node.geometry().clear()
node.geometry().merge(geo)

check out this Masterclass:
https://vimeo.com/222881605 [vimeo.com]
Edited by goldfarb - Feb. 27, 2018 13:34:47
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
76 posts
Joined: March 2007
Offline
Hi Michael,

Very useful info! The manual could do with some examples.
The one you give here is already different to the ones in the video because they use hou.Geometry() rather than hou.pwd().geometry() to work on.

I've already solved my problem with a regular foreach sop network.
Also because I realized I needed a Refine Sop anyway which is not yet supported as verb.
I just needed to add a new point in my curve. Surely I could have used a Fuse verb afterward but that would be a bit dirty.

But I'm sure I will use verbs at some point!

And I'll also start using compile blocks soon.
I'm considering using the spare inputs also when not using compile blocks.

cheers,
benS
  • Quick Links