Hi
I am trying to use hscript to drive a procedural Polysplit SOP.
In the Test_02.bgeo file I have a geometry (Test_GEO.bgeo) and a set of points (Test_POINTS.bgeo)that are scattered on the geometry border. A few of these points are not on the geometry though, and should be ignored.
I would like to insert an edge loop in the geometry starting from each of the points, using a PolySplit SOP.
I am using a For Each block. Inside it there is a Point Wrangle that I use to create a string detail attribute called @cutPoint marking the edge and position where I want the edge loop to appear in each iteration. I then feed this string to the polySplit with a
`details(-1,"cutPoint")` expression.
Unfortunately I am doing something wrong because I can not get it to work for more then a single point.
Any help on what the mistake is?
Is there an easier way to do this?
Procedural PolySplit
1655 5 0- PaoloGiandoso
- Member
- 63 posts
- Joined: 6月 2020
- Offline
- derrick
- スタッフ
- 329 posts
- Joined: 7月 2005
- Offline
I think you want feedback instead merge for the loop's gather method. PolySplit was failing because it was asked to split at a non-existent location (edge #3 on a triangle). I've updated the code to determine the correct edge. It is also best not to assume a specific interpretation of the individual values in uv so the code now computes the position along the edge.
Attached is an updated example.
Attached is an updated example.
- PaoloGiandoso
- Member
- 63 posts
- Joined: 6月 2020
- Offline
derrick
I think you want feedback instead merge for the loop's gather method. PolySplit was failing because it was asked to split at a non-existent location (edge #3 on a triangle). I've updated the code to determine the correct edge. It is also best not to assume a specific interpretation of the individual values in uv so the code now computes the position along the edge.
Attached is an updated example.
Amazing THANKS!
Question
I wrote
`details(-1,"cutPoint")`
with backticks instead of
details(-1,"cutPoint")
why was that a mistake? Is not the attribute an expression?
I saw that toward the end you used the function vertexprimindex(0, hedge_srcvertex(0, hEdgeToCut))
Is the primitive Vertex Index the half-edge number requested by the polySplit SOP?
- derrick
- スタッフ
- 329 posts
- Joined: 7月 2005
- Offline
PaoloGiandoso
Question
I wrote
`details(-1,"cutPoint")`
with backticks instead of
details(-1,"cutPoint")
why was that a mistake? Is not the attribute an expression?
I don't see any mistake there. You should be able to use backticks around the expression. I generally prefer creating a channel and writing an expression without the backticks because I find the change in colour makes it easier for me to easy notice what fields have expressions.
PaoloGiandoso
I saw that toward the end you used the function vertexprimindex(0, hedge_srcvertex(0, hEdgeToCut))
Is the primitive Vertex Index the half-edge number requested by the polySplit SOP?
The format expected by PolySplit doesn't use half-edge numbers. Imagine enumerating the edges of a polygon. It expects that number for your edge in the polygon. This is really the same number as if you enumerated the vertices in the polygon.
- PaoloGiandoso
- Member
- 63 posts
- Joined: 6月 2020
- Offline
derrick
I don't see any mistake there. You should be able to use backticks around the expression. I generally prefer creating a channel and writing an expression without the backticks because I find the change in colour makes it easier for me to easy notice what fields have expressions.
Thanks
When you say channel, do you mean a Keyframe? Is it the same thing?
Does creating a keyframe tells houdini to evaluate the text as an expression instead of a string?
- derrick
- スタッフ
- 329 posts
- Joined: 7月 2005
- Offline
PaoloGiandoso
When you say channel, do you mean a Keyframe? Is it the same thing?
Does creating a keyframe tells houdini to evaluate the text as an expression instead of a string?
Yes, that is what I mean. Once you set a keyframe, you can click on the parameter's label to switch between viewing the expression and what it evaluates to. I find this more useful than using backticks because the colour makes it easier to notice there is an expression and I can click on the label to see what value the expression produced.
-
- Quick Links