c# socket with houdini

   9586   13   1
User Avatar
Member
22 posts
Joined: Oct. 2011
Offline
Hi all.

I have had good success “talking” to houdini through a c#(mono) socket.
It would seem that it is much faster, than using hcommand or hython.


when i send hscript through the socket, there is no problem.
but when I send python command as :

<?xml version='1.0'?><python_statements>print “hello world”</python_statements>


i have a problem :

I can manipulate houdini, but I can not seem to return values back down the socket. The values are however printed in the houdini python terminal
This is not the case with hscript, which works fine.

I would like to get vertex info (position,color,uv)

I know how to do the with python, but as I have mention, I am not getting the return values through the socket

My problem can have two solutions (preferably both) :

1. How do I query vertex attributes using hscript ?
2. How do I make houdini python send outputs through the socket.

I a still learning this stuff, so there are still gaps in my knowledge .

I would really appreciate some pointers on this.

PS : I am on Mac
User Avatar
Member
71 posts
Joined: Feb. 2010
Offline
also it would be great if someone could share knowledge on accessing hou modules from python and other languages such as maya,xsi etc
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
I do not remember exactly what the code is, but you can add a python folder to your interpreter via the sys module (sys.append I believe) I have been able to import maya.standalone inside of houdini in that fashion
-G
User Avatar
Member
22 posts
Joined: Oct. 2011
Offline
I would like to reframe this question as it seems to have gone a little off-topic.

The purpose of my enquiry is to enable Houdini RPC in .NET applications through a network socket.
http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.aspx [msdn.microsoft.com]

one thing that would really help for now is :

How do I query geometry properties(points/polys/etc) in hscript ?
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
Hey Rom, I apologize. To answer your second question, you can query attributes on a mesh with the following commands:

point() for point attributes,
prim() for primitive (poly) attributes
vertex() for vertex attributes

For example, point(“../yournode”, $PR, “Cd”, 0) would query the red channel of point $PR


I am not sure about your first question though.
-G
User Avatar
Member
22 posts
Joined: Oct. 2011
Offline
mmm, I am aware of the python hou.geomerty.point/prim/vertex

Is there an hscript equivalent ?

If not a least I know.
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
The commands in my previous message are actually hscript
-G
User Avatar
Member
330 posts
Joined: July 2007
Offline
grayOlorin
..

For example, point(“../yournode”, $PR, “Cd”, 0) would query the red channel of point $PR


..

$PR .. stands for primitives . for points you better use $PT instead .


=P
except the things that cannot be seen , nothing is like it seems .
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
Oops! Sorry you are right, $PT is tge variable for that example
-G
User Avatar
Member
22 posts
Joined: Oct. 2011
Offline
awesome, awesome,
thanx guys

I'll have a crack at this tomorrow and give you some feedback.
User Avatar
Member
22 posts
Joined: Oct. 2011
Offline
Edited by - Oct. 28, 2011 19:42:33
User Avatar
Member
22 posts
Joined: Oct. 2011
Offline
mmmf, I'm not sure what I am doing wrong here.

In the textport :


point(“../box1”, $PT “Cd”, 0)

I get
Unknown command : point


are you sure this is hscript ?

It really should be able to work in the textport, remember I need to send this command from a external application.

In the list of hcommands in the docs, there is no command named point, prim or vert

what am I missing here ?

It would seem that point/prim/vert are expression functions that cannot be executed via RPC
User Avatar
Member
22 posts
Joined: Oct. 2011
Offline
ok I have figured it out

echo `point(“/obj/box/box1”,0,P,0)`

ie back tick the function

This will serve me ok, but I would really like to use python
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
I do not remember exactly what the code is, but you can add a python folder to your interpreter via the sys module (sys.append I believe) I have been able to import maya.standalone inside of houdini in that fashion
-G
  • Quick Links