I have problem while doing Boolean difference of two solids in Python scripting component.
If I use difference = rs.BooleanDifference(Box, Spheres) then the error is “Runtime error(NullReferenceException): Object reference not set to an instance of an object”.
If I use difference = Rhino.Geometry.Brep.CreateBooleanDifference(Box, Spheres, 0.01) then the error is “Runtime error(ArgumentTypeException): expected Brep, got Guid”.
But if I take the output of Box and Spheres and input them to a different Python scripting component and perform the 1st method then it works fine. Also using SolidDifference component
Thanks for the reply. Yeah selecting type hint as Brep on input parametres it works only if I come out of the Python scripting component and I have to create another component.
I want to perform Boolean operation in the Python scripting component itself.
I also tried your idea of wrapping Box in a list, but I got error as unexpected indent .
Can you please edit the Python component in my Grasshopper file and help me ?
Thank you very very much for your help. Now my Boolean Difference is working fine.
I have one more query. If the Spheres created are completely inside and isolated in the Box then the Boolean Difference won’t happen. The Boolean Difference occurs only if the spheres are intersecting the Box.
Please forgive me if this is a naive question. Is there any way to remove isolated Spheres (without any intersection with boundary of Box) from the Box.