Grasshopper

algorithmic modeling for Rhino

Hi Guys,

I am writing a script to create a recursive boolean function in c# and I reached a good level where all the intersected geometries get unioned. Some times there is a brep that doesn't intersect and that breaks the loop before it starts. Now I am looking for a method does something similar to this :

List<Brep> unionedParts = ...;

List<Brep> Leftovers = ...;

double Tolerance = 0.1;

if (Brep[] Brep.CreateBooleanUnion(unionedParts, Tolerance))

{

   ___Continue the operation___

}

else

{

   Leftovers.AddRange(unionedParts);

};

Can anyone tell me how to do it pleas?

I am in a rush .....

Views: 2302

Replies to This Discussion

That's very easy. Just post a test case with these Breps of yours

Curve[] lstCrvs ;
    Point3d[] lstPts ;


    bool N = Rhino.Geometry.Intersect.Intersection.BrepBrep(x, y, 0.01, out lstCrvs, out lstPts);
    A = N;
    B = lstCrvs;

This only outputs aTrue value. What does this True refers to ?

Still no test "items" provided. That said ALWAYS do that regardless if you think that's irrelevant/not required.

After that all the answers could be on hand.

Hi,

Just Uploaded the files so you have a look.

I just want to know how to store the unioned geometry before the loop crashes. I have made a condition for an intersection event but it didn't succeed because sometimes there is an intersection but no union and the loop crashes.

Attachments:

The only alternative is that I will go for a trim instead because if there is an intersection there will be a trim.

Well ...

1. For a vast variety of reasons I would strongly suggest to adopt some sort of "sequential" item access policy (like the one used here by sorting the box centers "along" X). Of course NOT all the cases allow that ... but anyway. Additionally always take some provision with regard how many "items" to process.

2. For some reason your Breps slow down an already struggling Rhino (Rhino is pathetic in anything related with "solid" ops: expected since is a surface modeller).

See yours:

VS mine:

3. Exploit the C# in order to get the gist of the whole policy used: what is the "failures" DataTree, what is the current union result etc etc.

Attachments:

BTW: Of course this:

Brep[] uni = Brep.CreateBooleanUnion(bList, tol); [where bList is the demo Breps used]

makes an Array of Breps - at once (with a little dose of Karma)

BUT ... if you do that in your Brep List you get null (explanations later).

Fair enough ! Many thanks. Awaiting the response of why the pipes give null value during a boolean. These pipes has been created out of lofted circular crosssections !.

Is there a way to break the loop before the null value occurs ? because boolean union method never outputs an Event boolean so it will always run and crash. for me it is enough just to get the pipes unioned till one of them breaks the loop. if not what the plan B could be like ?

Appears that's time for the trad update: the V2, that is (more checks [VS tolerance], far more elaborated loop control, explanations [inside the def], more complexity, slower, 2 divisions by zero  [for the brave] == progress).

BTW: sorted pipe N1 ("along" X) doesn't intersect with the rest

BTW: planar union BrepFaces are a clear mess (it should be one BrepFace).

BTW: Instead of Lofting (case: pipes like yours) use the approach as found in the "small" C# that prepares the demo Breps ("extrude" at once a BrepFace [both sides or not], that is).

Here's the V2.

More freaky options than Sahara has grains of sand: this is what we call progress these days => making a "simple" task utterly chaotic for no reason (kinda like Windows), he he.

Use rather the demo in order to get the gist of the whole thingy. Notice that the AtOnce option occasionally fails (but s#%@t happens all the times in this business).

Note: If you remove the Ducati promo stuff a virus (DucatiUberAlles) would destroy your computer (and you).

May the Force (the dark option) be with you

best, Lord of Darkness

Attachments:

I will have a look on that. It was a good experiance to know what to avoid in life. I won't comprimize my health with such a thing again.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service