Grasshopper

algorithmic modeling for Rhino

Hi,

Here is a part of my Code I've been spending a few hours on solving. I finally came to the point that I have no clue what causes the error.

Here's the code

doc.Objects.AddBrep(singleSubstract);
doc.Objects.AddBrep(singleVolumeToSubstractFrom);
                
Brep[] tempBrep = Brep.CreateBooleanDifference(singleSubstract, singleVolumeToSubstractFrom, tol);

tempBrep = Brep.CreateBooleanDifference(singleVolumeToSubstractFrom, singleSubstract, tol);

What it does basically is take to Breps (that are added to the document for debug reasons) and create the boolean difference.

In both cases "Brep.CreateBooleanDifference" returns "null".

But the volumes actually intersect and if I create the boolean difference manually in Rhino, both versions work.

Does anyone have a clue, why that might happen.

(tol is doc.ModelAbsoluteTolerance)

Thanks

- Martin

Views: 1402

Attachments:

Replies to This Discussion

It would be helpful to see your grasshopper document with the script to troubleshoot. When I use the following script: 

private void RunScript(Brep x, Brep y, ref object A)
{
A = Brep.CreateBooleanDifference(x, y, 0.1);
}

The boolean is created correctly with the geometry you provided. This doesn't seem too different from what you're doing, so I don't know why you're running into trouble without seeing the actual script. 

I guess tolerance value is the key to make it to work or not.

I cannot test a script at the moment as I broke the code editor, but if I reference those two shapes and use the Grasshopper Solid Difference components it also works. Can you confirm?

I don't see anything wrong with the code that might explain the nulls.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

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