@Clive wrote:
Hi,
Can someone please help with this?
Two separate functions generate 2 3D objects,
The third function runsBoolintersectionover them.
The 1st curve is expected to be updated byCageEdit.
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,Result,arrObjects1 arrObjects1 = Rhino.GetObjects("Pick 1st curve(s)", 4, False, True) arrObjects2 = Rhino.GetObjects("Pick 2nd curve(s)", 4, False, True) 'Rhino.EnableRedraw False For i=0 To 5 Boolintersection arrObjects1, arrObjects2, i Next 'Rhino.EnableRedraw True End Sub Function Pol(arrObjects1, i) If IsNull(arrObjects1) Then Exit Function For Each strObject In arrObjects1 '' 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 Rhino.SelectObjectGrip Objects(0), 4 arrPoints = Rhino.ObjectGripLocation(Objects(0), 4) If Isarray(arrPoints) Then arrPoints(0) = arrPoints(0) - i Rhino.ObjectGripLocation Objects(0), 4, arrPoints End If End If '' Make 3D Object strSurf = Rhino.ExtrudeCurveStraight(strObject, arrPath) Rhino.CapPlanarHoles strSurf Next Pol = strSurf End Function Function Cir(arrObjects2) If IsNull(arrObjects2) Then Exit Function For Each strObject In arrObjects2 '' Make 3D Object strSurf = Rhino.ExtrudeCurveStraight(strObject, arrPath) Rhino.CapPlanarHoles strSurf Next Cir = strSurf End Function Function Boolintersection(arrObjects1, arrObjects2, i) Dim curveA,curveB,arrObj curveA = Pol(arrObjects1, i) curveB = Cir(arrObjects2) arrObj = Rhino.BooleanIntersection(curveA, curveB) If IsNull(arrObj) Then Rhino.Print "Curves do not intersect" End If End FunctionThe following part In
Function Pol(arrObjects1, i)seems to be skipped in the second step.
becauseRhino.SelectObject strObjectis ignored by some reasons,Objects = Rhino.LastCreatedObjects If Isarray(Objects) Then Rhino.SelectObjectGrip Objects(0), 4 arrPoints = Rhino.ObjectGripLocation(Objects(0), 4) If Isarray(arrPoints) Then arrPoints(0) = arrPoints(0) - i Rhino.ObjectGripLocation Objects(0), 4, arrPoints End If End IfThis is what command line shows when the code is run in the first loop:
and the second loop:
Posts: 1
Participants: 1
