Hi!
I have a problem with python “createNode()” function.
For create a box, for example, I write: “ box = geo.createNode('box')”. But I don't have a list of parameters for create another nodes (Extrude, Lsystem, tube…..).
Does some list of parameters exist for this function? In the tutorials it is not exist.
Thank you very much!
Python "createNode" function
38483 13 0- froure
- Member
- 15 posts
- Joined: 4月 2008
- Offline
- chico
- Member
- 3 posts
- Joined: 7月 2007
- Offline
List of parameters can be accessed via parms() method of the node - box.parms()
You can create another node, ‘extrude’ for example, just like the first node - with createNode method and then connect your box node to extrude node via setInput method called from the second node, that is clear, since you're specifying input.
This info is from hom documentation :wink:
You can create another node, ‘extrude’ for example, just like the first node - with createNode method and then connect your box node to extrude node via setInput method called from the second node, that is clear, since you're specifying input.
This info is from hom documentation :wink:
- JColdrick
- Member
- 4140 posts
- Joined: 7月 2005
- Offline
I don't think that's what he's asking for. He was interested in a method that lists all possible node types that he could enter. AFAIK, the only thing you can currently use is ‘opadd’ - but that's sorta cheating since it's not python, it's hscript.
Hopefully these sorts of corners get filled in as time goes on…
Cheers,
J.C.
Hopefully these sorts of corners get filled in as time goes on…
Cheers,
J.C.
John Coldrick
- froure
- Member
- 15 posts
- Joined: 4月 2008
- Offline
- Array
- Member
- 10 posts
- Joined: 1月 2007
- Offline
JColdrick
I don't think that's what he's asking for. He was interested in a method that lists all possible node types that he could enter. AFAIK, the only thing you can currently use is ‘opadd’ - but that's sorta cheating since it's not python, it's hscript.
Hopefully these sorts of corners get filled in as time goes on…
Cheers,
J.C.
Is there a list somewhere which actually lists all of the possible node types that can be passed into createNode()? I've been trying to figure it out all morning and its driving me nuts.
- mtucker
- スタッフ
- 4525 posts
- Joined: 7月 2005
- Offline
- Array
- Member
- 10 posts
- Joined: 1月 2007
- Offline
- Array
- Member
- 10 posts
- Joined: 1月 2007
- Offline
- graham
- Member
- 1922 posts
- Joined: 11月 2006
- Offline
A grid or a sphere cannot be made at the object level. You have to create a geo object, then create the grid of sphere inside it. What you are trying to do is actually the result of a tool operation that creates a geo object, destroys the file sop, then creates the required type of sop.
Graham Thompson, Technical Artist @ Rockstar Games
- Array
- Member
- 10 posts
- Joined: 1月 2007
- Offline
graham
A grid or a sphere cannot be made at the object level. You have to create a geo object, then create the grid of sphere inside it. What you are trying to do is actually the result of a tool operation that creates a geo object, destroys the file sop, then creates the required type of sop.
Ahhh, gotcha, thanks!
- Array
- Member
- 10 posts
- Joined: 1月 2007
- Offline
OK, here are my first baby steps into Houdini:
#===========================================
# make a group of spheres
#===========================================
hou.hipFile.clear()
def createSpheres(numSpheres, dX, mY, mZ):
i = 0
temp = 0
spheres = * numSpheres
for i in range(0, numSpheres):
tString = “sphere_” + str(i)
spheres = hou.node('/obj').createNode('geo', tString, 0 )
spheres.node('/obj/' + tString).createNode('sphere')
spheres.moveToGoodPosition()
spheres.parm('tx').set(i * dX)
temp = spheres.evalParm('tx') % mY
spheres.parm('ty').set(temp)
temp = spheres.evalParm('ty') % mZ
spheres.parm('tz').set(temp)
createSpheres(100, 2, 5, 8)
This is a lot of fun! Thanks again for the help
#===========================================
# make a group of spheres
#===========================================
hou.hipFile.clear()
def createSpheres(numSpheres, dX, mY, mZ):
i = 0
temp = 0
spheres = * numSpheres
for i in range(0, numSpheres):
tString = “sphere_” + str(i)
spheres = hou.node('/obj').createNode('geo', tString, 0 )
spheres.node('/obj/' + tString).createNode('sphere')
spheres.moveToGoodPosition()
spheres.parm('tx').set(i * dX)
temp = spheres.evalParm('tx') % mY
spheres.parm('ty').set(temp)
temp = spheres.evalParm('ty') % mZ
spheres.parm('tz').set(temp)
createSpheres(100, 2, 5, 8)
This is a lot of fun! Thanks again for the help
- graham
- Member
- 1922 posts
- Joined: 11月 2006
- Offline
Here's that written in a more Python/Houdini way since it doesn't require
all the extra assignments and list usage and taking advantage or some of the nice Houdini features.
def createSpheres(numspheres, tx, ty, tz):
spheres =
for i in range(numspheres):
geo = hou.node('/obj').createNode('geo','sphere_' + str(i))
geo.node('file1').destroy()
geo.createNode('sphere')
geo.moveToGoodPosition()
spheres.append(geo)
xval = i * tx
yval = xval % ty
zval = yval % tz
geo.parmTuple('t').set((xval, yval, zval))
all the extra assignments and list usage and taking advantage or some of the nice Houdini features.
def createSpheres(numspheres, tx, ty, tz):
spheres =
for i in range(numspheres):
geo = hou.node('/obj').createNode('geo','sphere_' + str(i))
geo.node('file1').destroy()
geo.createNode('sphere')
geo.moveToGoodPosition()
spheres.append(geo)
xval = i * tx
yval = xval % ty
zval = yval % tz
geo.parmTuple('t').set((xval, yval, zval))
Graham Thompson, Technical Artist @ Rockstar Games
- Array
- Member
- 10 posts
- Joined: 1月 2007
- Offline
graham
Here's that written in a more Python/Houdini way since it doesn't require
all the extra assignments and list usage and taking advantage or some of the nice Houdini features.
def createSpheres(numspheres, tx, ty, tz):
spheres =
for i in range(numspheres):
geo = hou.node('/obj').createNode('geo','sphere_' + str(i))
geo.node('file1').destroy()
geo.createNode('sphere')
geo.moveToGoodPosition()
spheres.append(geo)
xval = i * tx
yval = xval % ty
zval = yval % tz
geo.parmTuple('t').set((xval, yval, zval))
Oh, awesome, thanks! I should also mention that this is not only my first foray into Houdini, but also Python. ops:
At work I use nothing but C, and not even ANSI 99 C. It's like a time warp, haha.
- froure
- Member
- 15 posts
- Joined: 4月 2008
- Offline
Hi friends!
I create a little functions for view a parameters of nodes:
def api(node):
g = hou.node('/obj').createNode('geo')
n = g.createNode(node)
print n.parms()
g.destroy()
def api2(node, param):
g = hou.node('/obj').createNode('geo')
n = g.createNode(node)
print n.parm(param).parmTemplate()
g.destroy()
in python shell:
import myfilefuntions
myfilefunctions.api('')
myfilefunctions.api2('', '')
It is somethings stupid, but for working is good! XD
Thanks!
I create a little functions for view a parameters of nodes:
def api(node):
g = hou.node('/obj').createNode('geo')
n = g.createNode(node)
print n.parms()
g.destroy()
def api2(node, param):
g = hou.node('/obj').createNode('geo')
n = g.createNode(node)
print n.parm(param).parmTemplate()
g.destroy()
in python shell:
import myfilefuntions
myfilefunctions.api('')
myfilefunctions.api2('', '')
It is somethings stupid, but for working is good! XD
Thanks!
-
- Quick Links