Jump to content

Boolean subtract geometry from curves?

Recommended Posts

You can also PolyExtrude the curves before the Boolean and then blast the new points afterwards using a few Group nodes before and after the Boolean (Credits: Entagma)

Share this post

Share on other sites

this is very good thread. i did test all approaches and im getting best results from satoru's setup (testing on 58k curves - cad drawings, where im making bridges for router).

But that being said, i found scenario where even his method fails. And thats when curve goes through two cutting objects where curve points are outside. See sample image (as input i have curve with two poins)

• 1

Share this post

Share on other sites

mine works...well ok i got 3 cutting objects but who's counting...

Edited by Noobini

Share this post

Share on other sites

it comes back to selecting points inside an object....there's no point inside to be found coz they are ON the surface...and NO....that's not having a dig at other contributors to this thread...they're all good...I learnt plenty from them.

Share this post

Share on other sites

Here's a compromise solution. I was having trouble getting this to work with Intersection Stitch, but that might just be my misunderstanding it. It was adding inline points but not in any order that I could use to actually split the path into individual prims. PolySplit seemed to work better for that.

To fix the problem of points existing on the surface, I just uniqued each segmented prim's points and moved them very slightly towards their neighbor. Seems to work on both busy curved lines and the straight line through a torus example posted above.

edit: forgot to fuse afterwards. this one re-attaches the segments afterwards.

curve_bool_3.hip

Edited by toadstorm
• 1

Share this post

Share on other sites

shhhh...don't tell the architect guys you moved the points slightly....you never know they might demand their 5th decimal point accuracy back.

Share this post

Share on other sites
2 minutes ago, Noobini said:

shhhh...don't tell the architect guys you moved the points slightly....you never know they might demand their 5th decimal point accuracy back.

they get moved back after testing!

but really though, biasing things like raycasts and such is a pretty normal thing to do when dealing with imperfect things like polygon meshes; I'm not worried about those kinds of cheats. there's acceptable margins of error for any scene.

Share this post

Share on other sites
3 minutes ago, toadstorm said:

they get moved back after testing!

but really though, biasing things like raycasts and such is a pretty normal thing to do when dealing with imperfect things like polygon meshes; I'm not worried about those kinds of cheats. there's acceptable margins of error for any scene.

oh yeah...i'm blind, sorry about that...

(your wrangle is still abit too advanced for me tho...it'll take awhile to sink in)

Edited by Noobini

Share this post

Share on other sites
3 hours ago, martinkindl83 said:

this is very good thread. i did test all approaches and im getting best results from satoru's setup (testing on 58k curves - cad drawings, where im making bridges for router).

But that being said, i found scenario where even his method fails. And thats when curve goes through two cutting objects where curve points are outside. See sample image (as input i have curve with two poins)

Thank you Martin for verifying this!

It is a problem that arises when I use a newly added cut-point as an inner point.

The problem was avoided by checking the inner line again.

I also like your way.

Edited by satoru
• 1

Share this post

Share on other sites
8 minutes ago, satoru said:

Thank you Martin for verifying this!

It is a problem that arises when I use a newly added cut-point as an inner point.

The problem was avoided by checking the inner line again.

Good update. i had fix that was working for mine specific case, but your solution is way better.

Funny how you can use Houdini for preparing CNC data

Share this post

Share on other sites

here's another one.
it's a simple vex solution which works basically by counting the number of intersections along the curve and the fact that an uneven number means it`s inside an object ...

hth.
petz

• 7
• 1

Share this post

Share on other sites

satoru's solutions works without any problems on my setup (some CAD curves and some voodoo in Houdini), Peter's VEX works for 90% of curves, but there are some occasions when its failing.

anyway, i think that the main focus of this topic was fulfill in several ways.

Share this post

Share on other sites

Had to give this a go. This is a one wrangle solution, the issue i have come into is that it wont cut several curves. Putting it inside a for-each loop fixes this, but its not optimal. The code should work without it, but i cant manage to find where the problem lies.

Features that it doesnt support atm is intersecting meshes, surfaces and meshes that covers the ends (want to solve the multicurve issue first).

Heres the code:

```int primpts[] = primpoints(0,@primnum);
vector newpos[] = {},intlist[] = {},uvlist[] = {};
int posinfo[] = {}, primlist[] = {};
int newprim = addprim(0,"polyline");
int toggle = 1;
int removenext = 0;

foreach(int i;primpts)
{
vector p01 = point(0,"P",primpts[i]);
push(newpos,p01);
push(posinfo,1);
if(i != primpts[len(primpts)-1]){

vector p02 = point(0,"P",primpts[i+1]);
vector ray = p02-p01;
intersect_all(1,p01,ray,intlist,primlist,uvlist,chf("tol"),chf("mergetol"));

foreach(vector j;intlist)
{
push(newpos,j);
push(posinfo,0);
}
}
}

foreach(int index;vector k;newpos)
{
if(removenext == 0 || posinfo[index]==0){
int newpoint = addpoint(0,k);
setpointattrib(0,"origprim",newpoint,@origprim,"set");
setpointattrib(0,"cut",newpoint,posinfo[index],"set");
addvertex(0,newprim,newpoint);
}
if(posinfo[index]==0){
if(removenext == 1){
removenext = 0;
}
else{
removenext = 1;
newprim = addprim(0,"polyline");
}
}

}
removeprim(0,@primnum,1);
```

Boolean_Curve_01.hiplc

Share this post

Share on other sites
On 02/02/2018 at 9:55 PM, petz said:

here's another one.
it's a simple vex solution which works basically by counting the number of intersections along the curve and the fact that an uneven number means it`s inside an object ...

hth.
petz

I never stop learning every single time I see one of your example scenes... what a joy to see this elegant solution. Thank you.

• 2

Share this post

Share on other sites
23 hours ago, jordibares said:

I never stop learning every single time I see one of your example scenes... what a joy to see this elegant solution. Thank you.

thanks, you're welcome!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×