How to copy geometry in python?

   5911   5   0
User Avatar
Member
7 posts
Joined: 10月 2013
Offline
I create a python type Digital Assets
I want to use python to copy input geometry some times like COPY SOP.
But I can't find the right method in hou.Geometry class.
Please help,so thanks . :roll:
User Avatar
Member
183 posts
Joined: 11月 2008
Offline
In Python SOP:

this_geo = node.geometry()
source_geo = get_geometry_somewhere()
for i in range(10):
new_geo = hou.Geometry()
new_geo.merge(source_geo)
# Do something with new_geo
this_geo.merge(new_geo)
Aleksei Rusev
Sr. Graphics Tools Engineer @ Nvidia
User Avatar
Member
7 posts
Joined: 10月 2013
Offline
It's right . so thanks .
User Avatar
Member
7 posts
Joined: 10月 2013
Offline
Stalkerx777
In Python SOP:

this_geo = node.geometry()
source_geo = get_geometry_somewhere()
for i in range(10):
new_geo = hou.Geometry()
new_geo.merge(source_geo)
# Do something with new_geo
this_geo.merge(new_geo)

Yes,I can use merge method to copy other sop into it.

But I have new problem.

Box —-> My Python Copy SOP

How can I realize the copy Box some times and Create Output Groups function?

=====================
And can I read the Copy SOP source,then I can get more information?
User Avatar
Member
183 posts
Joined: 11月 2008
Offline

grp = geo.createPrimGroup('mygroup')
grp.add(prim)
Aleksei Rusev
Sr. Graphics Tools Engineer @ Nvidia
User Avatar
Member
7 posts
Joined: 10月 2013
Offline
Stalkerx777

grp = geo.createPrimGroup('mygroup')
grp.add(prim)

thanks.but this is not perfect

grp.add(self.prims())
this method can merge itself.
but run this method again,will get four times

I want to get three times or five times.
this method can't do it.

I want copy original prims with the special number and ,put the output to a new group,like Copy SOP in python
  • Quick Links