Python sop - copy geometry

   4667   4   1
User Avatar
Member
2199 posts
Joined: July 2005
Online
Is there any easy way in a python sop to just copy the geometry from an input other than the first? In the hdk you would destroy the gdp and merge in one from another gdp.
The trick is finding just the right hammer for every screw
User Avatar
Member
1909 posts
Joined: Nov. 2006
Online
The best you can do right now is make use of hou.Geometry.merge(). If you delete all the prims or points, then merge in the geometry from the 2nd input you can get what you are after.
prims = geo.prims()
geo.deletePrims(prims)
geo.merge(hou.pwd().inputs().geometry())

merge(self, geometry)
Merge the points and primitives from another hou.Geometry object
into this one. The new points and primitives are appended to this
geometry's points and primitives. You would typically call this
method from the code of a Python-defined SOP.

Raises hou.GeometryPermissionError if this geometry is not
modifiable.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
2199 posts
Joined: July 2005
Online
Perfect! is that an undocumented function, I didn't see it in my searches?
Is there a way to get a definitive list without looking in the help?
The trick is finding just the right hammer for every screw
User Avatar
Member
401 posts
Joined:
Offline
what version of Houdini this was introduced?
this is not a science fair.
User Avatar
Member
2199 posts
Joined: July 2005
Online
not in H10.0.416 but in H10.0.528
The trick is finding just the right hammer for every screw
  • Quick Links