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: 2393

Replies to This Discussion

Thanks for the assistance. I am always learning from your style of scripting.

Forgot to mention that IF you don't ride a (*) Ducati (**) within 6 days the DucatiUderAlles virus would destroy (***) your computer (and you).

(*) a Panigale, what else?

(**) properly

(***) no mercy!

Your script is awesome! Exactly what I needed. Really well done. Gotta admit I was a lil afraid to download because you speak like you have a virus in your amygdala. I guess if you let your shadow hang all the way out, it can really do some heavy lifting. 

The problem is that the method breaks when the boolean doesn't occure. It doesn't output a boolean value or continue to the other breps

I'll bet you are accessing an empty list, the error message is index out of range? If so, simply checks if the array has some brep element.

No, it is not an empty list it is just that the intersection event Brep.Brep boolean gives me always a True value even if the two Breps never intersect. Any ideas ?

Curve[] lstCrvs ;
    Point3d[] lstPts ;


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

brep.CreateBooleanUnion() return an array of brep, if this array is empty, then you know that has not occurred an union, if you have an item has gone successfully, and if you have two or more, then they would not have joined. So, check that array and if .count <> 1 then continue for.

Thanks for the answer. The boolean crashes the script before the value stored. What I am looking for is a good exit procedure before the union crashes the script.

Thanks. I have no idea of what are you are talking about. but worth to be investigated !. I think it is the same as limiting the number of iterating the union. the concept was to control where the boolean begins when I face  such  case where there are list of objects to union.

Probably it has to do with the intersection events.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service