Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5815

Put RhinoScript Boolean in a Loop

$
0
0

@Clive wrote:

Hello Everyone,
I am stuck with The following code that is supposed to
1. Take two curves within two separate procedures and make solid objects out of them.
2. Draw a bounding CagEedit for the curves.
3. implement BooleanIntersection in a third Function,
4. Provide a loop that in each step moves one control point, rebuilds the two 3D objects and Performs BooleanIntersection again.

Here is the code:

Dim arrObjects,strObject,strSurf
Dim Objects,subObj,arrPoints
Dim arrPath
arrPath = array(0, 0, 10)

Call main()
Sub main()

    Dim i
    For i=0 To 10 Step 2
       	 ????????????????????????
    Next
End Sub

Function Pol(i)

    arrObjects = Rhino.GetObjects("Pick 1st curve(s)", 4, False, True)
    If IsNull(arrObjects) Then Exit Function
    For Each strObject In arrObjects

	'' Make 3D Object

        strSurf = Rhino.ExtrudeCurveStraight(strObject, arrPath)
        Rhino.CapPlanarHoles strSurf

	'' Apply CageEdit

        Rhino.SelectObject strObject
	Rhino.Command("_CageEdit _Boundingbox _World _X=2 _Y=2 _Z=2 _Enter _Global _Enter")

	'' Move Control Points

	Objects = Rhino.LastCreatedObjects
	If Isarray(Objects) Then
		For Each subObj In Objects
			Rhino.SelectObjectGrip subObj, 4
			arrPoints = Rhino.ObjectGripLocation(subObj, 4)
			If Isarray(arrPoints) Then
				arrPoints(0) = arrPoints(0) - i
				Rhino.ObjectGripLocation subObj, 4, arrPoints
			End If
		Next
	End If
    Next
    Pol = strSurf
End Function

Function Cir()
    arrObjects = Rhino.GetObjects("Pick 2nd curve(s)", 4, False, True)
    If IsNull(arrObjects2) Then Exit Function
    For Each strObject In arrObjects

	'' Make 3D Object
        strSurf = Rhino.ExtrudeCurveStraight(strObject, arrPath)
        Rhino.CapPlanarHoles strSurf
    Next
    Cir = strSurf
End Function

Function Boolintersection(i)
    Dim curveA,curveB,arrObj
    curveA = Pol(i)
    curveB = Cir
    arrObj = Rhino.BooleanIntersection(curveA, curveB)
    If IsNull(arrObj) Then
        Rhino.Print "Curves do not intersect"
    End If
    Boolintersection = arrObj
End Function

Thanks in advance,

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5815

Trending Articles