Hello,
Can anybody please let me know why the following Boolean Difference is not working?
It still requires 2 arrInputs as Rhino Objects, but I cant figure out why my objects (cp & cp2) are not.
Call Main()
Sub main()
Dim strcr,ext,cp
strcr = Rhino.getobject("pick 1st")
ext = Rhino.ExtrudeCurveStraight(strcr, Array(0, 0, 0), Array(0, 0, 10))
cp = Rhino.CapPlanarHoles(ext)
If Rhino.IsObjectSolid(cp) Then
Rhino.print("THIS IS SOLID.")
Dim cp2
strcr = Rhino.getobject("pick 2nd")
ext = Rhino.ExtrudeCurveStraight(strcr, Array(0, 0, 0), Array(0, 0, 10))
cp2 = Rhino.CapPlanarHoles(ext)
If Rhino.IsObjectSolid(cp2) Then
Rhino.Print("THIS IS SOLID AS WELL.")
Rhino.BooleanDifference cp, cp2
End If
Else
Rhino.Print("The object is not Solid")
End If
End Sub
Rhino.BooleanDifference takes arrays as inputs for both sets of objects (cp, cp2).
In your case cp and cp2 are single string variables representing the extruded curves.
To make it work, try: Rhino.BooleanDifference array(cp), array(cp2)
This way you are feeding the method with arrays (what it needs) containing a single object each.
@Ncik
Sorry for the confusion,
The code is right on the top of this discussion. @Jerek advised to replace
Rhino.BooleanDifference cp, cp2
with
Rhino.BooleanDifference array(cp), array(cp2)
I meant that does not work either.
My goal is to have 2 drawn circles that have intersection with each other.
With this code I would expect to have the circles transformed into cylinders that-under booleandifference- their shared volume returned as the output.
I see, clearly the boolean was not a problem as it can work with single objects as input (the documentation is not clear on this one.). However, the problem in your script is the CapPlanarHoles method. It does only return True/False (success/failure). The variable used in the method still holds the resulting object.
See modified version of the script below:
Call Main()
Sub main()
Dim strcr,cp,cp2
strcr = Rhino.getobject("pick 1st")
cp = Rhino.ExtrudeCurveStraight(strcr, Array(0, 0, 0), Array(0, 0, 10))
Call Rhino.CapPlanarHoles(cp)
If Rhino.IsObjectSolid(cp) Then
Rhino.print("THIS IS SOLID.")
strcr = Rhino.getobject("pick 2nd")
cp2 = Rhino.ExtrudeCurveStraight(strcr, Array(0, 0, 0), Array(0, 0, 10))
Call Rhino.CapPlanarHoles(cp2)
If Rhino.IsObjectSolid(cp2) Then
Rhino.Print("THIS IS SOLID AS WELL.")
Rhino.BooleanDifference cp, cp2
End If
Else
Rhino.Print("The object is not Solid")
End If
End Sub