Curve SOP: referencing coordinates

   6392   4   2
User Avatar
Member
27 posts
Joined: July 2005
Offline
hello again,

still learning Houdini…

So many things I want to do seem so simple, but when I go to do them, the OPs I've used in the tutorials won't work for those purposes. For the last several hours I've been trying to copy geometry objects onto points of a curve SOP. Simple enough…but I also need to access the (x,y,z) coordinates of each point in the curve SOP from the copy SOP.

The curve SOP does not appear to allow this. For example, when I copy values from the curve spreadsheet, I can only copy the value and not the variable reference. Any suggestions? Do I have to use a different transform SOP for every point on a curve filled with (0,0,0) points?

Does anyone have a comprehensive guide to expression syntax and variables? The help .pdf doesn't seem too comprehensive to me, but it could just be my naivete…
User Avatar
Member
4140 posts
Joined: July 2005
Offline
Just to be clear, the need to extract the xyz position of the points is something you want for a reason *other* than just copying the data to the points, right? Oftentimes I've found that when you're learning new software it isn't always the best idea to ask for a specific thing outside of the context you're putting it into. The workflow you choose could be done in a different way altogether - much simpler. For example, whatever you're trying to do may be accomplished trivially with stamping(I don't know - just a guess ).

Anyway, doesn't matter, always good to learn something - the docs are pretty complete for the expression stuff - check out the acrobat reference file under Help/Expression Language - it's more complete than the html quickie help…

If I wanted to reference a position in space for a particular point(the first, say) in a curve SOP(“curve1”, say), I would put these expressions in a transform(or where-ever):

point(“../curve1”,0,“P”,0) # = X position
point(“../curve1”,0,“P”,1) # = Y position
point(“../curve1”,0,“P”,2) # = Z position

without all the stuff after the #'s, of course. Params are, in order, the OP you want to reference, which point you want to look at, the attribute you want to grab(in this case P, or position), and which element in that attribute you want(0,1,2 for x,y,z).

Hope this helps. Lots and lots of stuff in the expressions to learn. It can be tough sometimes when you come from another package to “get” the best way to approach things - the tutorials help, but there's still a deep lake to wade into.

Feel free to post overall questions about “the best way” to approach a problem. You'll probably get 5 different responses…

Cheers,

J.C.
John Coldrick
User Avatar
Member
27 posts
Joined: July 2005
Offline
again, thanks for the help.

I guess I really didn't read those expression docs all that well! It was right there the whole time. It still seems, though, that some expressions are undocumented. For example, nearpoint() is not defined anywhere in the 6.0 docs that I can tell, and I haven't been able to get it to work yet. If it returns the position or the vector to the position on a NURBS curve closest to the given point, it's just what I've been looking for.

I suspect most of my channel reference problems will be solved once I master CHOPs, so I'll bother you guys again after I've thoroughly read those docs :?

BTW, Houdini is my first 3D package. My workflow so far is simply the way I think you should be able to do things, and for the most part Houdini has been happy to oblige. Anybody get it to do fluid dynamics?
User Avatar
Staff
2540 posts
Joined: July 2005
Online
Another alternative to grabbing point positions is to literally grab the point or it's position with an Add SOP or the Curve SOP respectively. Both can construct new geometry from the points or point positions of input geometry.

You can use the Add SOP like a “connect-the-dot's” tool. If you pipe in your geometry then choose “Delete the Geometry but keep the points”, then in the second folder, start typing in the names of the point numbers you are interested, then check “Delete unused points” you are left with the points you are interested in. You can then build polygons from those points. Read the help.

The Curve SOP supports the snapping to other points as it has a special prim-vertex reference nomenclature. The easiest way to “snap” to other points and inherit their reference position is to go to the snapping tools and turn on “consolidate” as the snapping option. Now drawing a curve while snapping to points will build the curve from that point's position.

The point() expressions can be slower on large data fyi.
There's at least one school like the old school!
User Avatar
Member
4140 posts
Joined: July 2005
Offline
For example, nearpoint() is not defined anywhere in the 6.0 docs that I can tell, and I haven't been able to get it to work yet.

Sure it's defined! It's just…hidden… You're right - it appears to be an oversight. SESI should take a look at this - the pdf Expression docs in 6.1.84 actually say “see also nearpoint()”, but don't actually contain the definition for it! However, there is a quickie definition in….wait for it….the html docs under expressions…

Thanks for pointing that out…it would be really nice if all the docs were consolidated somewhere. Personally I still like pdfs, but the html seem to be the direction everything's going. Hopefully the pdf's will be ported to html and everything will be in one place.

Cheers,

J.C.
John Coldrick
  • Quick Links