I tackle an interesting problem - how to stay procedural in Houdini. As an example I used a suggestion from the Houdini Facebook Group - how to create a procedural "Make Circle" function.
By selecting parts of the Geometry by hand I have a problem in my prcedural chain. I tried to find a possible solution by using the VEX logic.
What are your thoughts about the presented solution? Do you have more ideas where a procedural approach is needed? It could be an interesting new series - Make it Procedural - where I take your ideas and find the VEX coding to implement it.

#### CREATED BY

• Blumenbart 1 year ago  |

Very helpful! Would love to see more!
Thank you.

• Radivarig 9 months, 3 weeks ago  |

Thanks for the video! This is how I solved it:
1. First attribute wrangle (run over primitives), this returns points at center of each primitive
```
removeprim(0, @primnum, 1);
```
2. Second attribute wrangle (run over detail), 1th input is the subdivided polygon, 2nd is the center points wrangle from step 1.
```
for (int i = 0; i < npoints (1); ++i) { // for center points
int p = nearpoint (0, point (1, "P", i)); // get the same point from subdivided polygon
foreach (int pr; pointprims (0, p))
setprimgroup (0, "prims", pr, 1); //add prims surrounding point to a group
}
```
3. Lastly I used the free make circle asset from https://www.orbolt.com/asset/mifth::mifth_make_circle to convert these prims to circles.

To get unique points for a circle without the make circle asset, step 2 would be:
```
for (int i = 0; i < npoints (1); ++i) { // for center points
int p = nearpoint (0, point (1, "P", i)); // get the same point from subdivided polygon

int allPts[];
foreach (int pr; pointprims (0, p))
push (allPts, primpoints (0, pr)); // get all points from surrounding prims
allPts = sort (allPts); // sort for comparing with last

int pts[]; // unique points for circle
foreach (int pt; allPts)
if (pt != p) // if not center
if (pt != pts[len (pts) - 1]) // ignore duplicates by comparing with last
push (pts, pt);

printf ("center %s, points %s\n", p, pts);
// * last two for-loops from video to set pts on a circle
}
```
Cheers