logo

[H]ot Lava

Gallery details

APO MECHANES 2011 – Students: Michalis Bompolis, Nikos Vlavianos, Alvaro Arellano
–Code Generates Mesh OffSets and Frames Based on Luminance Values coming from Geometry Painted with PaintVertex Tool in Maya–
Dynamics + Python + RhinoScript Research V.4 [07.April.2011] – via Dynamics + RhinoScript

RHINOSCRIPT CODE

Option Explicit

'Script written by Luis Quinones

'Script copyrighted by [n]igma + studioBoom + computational matter

'www.luisquinonesdesign.com

'www.studioboomdesign.com

'www.computationalmatter.com

'Script version Sunday, March 20, 2011 8:08:03 PM



Call Main()

Sub Main()

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Call Rhino.MessageBox("Code Generates Mesh OffSets and Frames Based on Luminance Values -

         coming from Geometry Painted with PaintVertex Tool in Maya")

    'layer to store base mesh

    Dim strMainLayer : strMainLayer = Rhino.AddLayer("MainMesh")

    'pick Mesh which is unwelded at 0

    Dim strObject : strObject = Rhino.GetObject("Select mesh", 32)

    'store mesh in base layer

    Call Rhino.ObjectLayer(strObject,strMainLayer)

    ' get the face vertices of the mesh

    Dim arrFaces : arrFaces = Rhino.MeshFaces(strObject, True)

    'get the vertex colors of the mesh

    Dim color : color = Rhino.MeshVertexColors(strObject)

    'Dynamic + Fixed Arrays

    Dim arrFace(3),arrHLS(3),arrFace2(3)

    Dim arrFaceVertices2(0)

    Dim arrFaceVerts(0)

    Dim lengthCheck()

    Dim lengthCheck2()

    'Create Layers 

    Dim strLayer6 : strLayer6 = Rhino.AddLayer("BaseCrvs",RGB(255,0,0))

    Dim strLayer2 : strLayer2 = Rhino.AddLayer("OffsetCrv",RGB(255,0,0))

    Dim strLayer9 : strLayer9 = Rhino.AddLayer("OffsetCrv_Fillet",RGB(255,0,0))

    Dim strLayer : strLayer   = Rhino.AddLayer("OffSetMesh",RGB(255,0,0))

    Dim strLayer8 : strLayer8 = Rhino.AddLayer("OffSetMesh_Fillet",RGB(255,0,0))

    Dim strLayer3 : strLayer3 = Rhino.AddLayer("FrameDog",RGB(255,255,255))

    Dim strLayer11 : strLayer11 = Rhino.AddLayer("FrameDog2",RGB(255,255,255))

    Dim strLayer5 : strLayer5 = Rhino.AddLayer("0_ValueOffSet",RGB(120,120,120))

    Dim strLayer4 : strLayer4 = Rhino.AddLayer("Color_Vert_Info",RGB(255,255,0))

    Dim strLayer7 : strLayer7 = Rhino.AddLayer("TempStuff",RGB(255,255,0))

    Dim strLayer10 : strLayer10 = Rhino.AddLayer("Offset_SOLO",RGB(255,255,0))

    Dim strLayer12 : strLayer12 = Rhino.AddLayer("StrandyDandy",RGB(255,255,255))

    Dim strLayer13 : strLayer13 = Rhino.AddLayer("0.99ScaledCrv",RGB(255,255,255))

    Dim strLayer14 : strLayer14 = Rhino.AddLayer("SkinnyFrame",RGB(255,255,255))

    Dim i,j

    Dim count2

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    If IsArray(arrFaces) Then

        Rhino.EnableRedraw False

        i = 0

        count2 = 0

        Do While i <= UBound(arrFaces)

            arrFace2(0) = arrFaces(i)            

            arrFace2(1) = arrFaces(i+1)

            arrFace2(2) = arrFaces(i+2)

            arrFace2(3) = arrFaces(i+3)        

            If arrFace2(2)(0) = arrFace2(3)(0) And arrFace2(2)(1) = arrFace2(3)(1) And arrFace2(2)(2) = arrFace2(3)(2) Then            

                '    Call Rhino.MessageBox("SHIT")                

                arrHLS(0) = Rhino.ColorRGBToHLS(color(count2))

                'Call Rhino.Print(arrHLS(0)(1)/240)            

                arrHLS(1) = Rhino.ColorRGBToHLS(color(count2+1))

                'Call Rhino.Print(arrHLS(1)(1)/240)        

                arrHLS(2) = Rhino.ColorRGBToHLS(color(count2+2))

                'Call Rhino.Print(arrHLS(2)(1)/240)        

                arrHLS(3) = Rhino.ColorRGBToHLS(color(count2+2))

                'Call Rhino.Print(arrHLS(3)(1)/240)            

                Dim sum : sum = Rhino.Sum(array(arrHLS(0)(1)/240,arrHLS(1)(1)/240,arrHLS(2)(1)/240))    

                Dim ave : ave = sum/3    

                arrFaceVerts(0) = Array(0,1,2,2)        

                Dim arrMeshVerts : arrMeshVerts = Array(arrFace2(0),arrFace2(1),arrFace2(2),arrFace2(3))

                Dim arrVerticesNEW : arrVerticesNEW = arrMeshVerts            

                Dim newMesh : newMesh = Rhino.AddMesh(arrMeshVerts,arrFaceVerts)

                Dim meshCent : meshCent = Rhino.MeshAreaCentroid(newMesh)                



                count2 = count2 + 3                        

            Else                

                arrHLS(0) = Rhino.ColorRGBToHLS(color(count2))

                'Call Rhino.Print(arrHLS(0)(1)/240)            

                arrHLS(1) = Rhino.ColorRGBToHLS(color(count2+1))

                'Call Rhino.Print(arrHLS(1)(1)/240)        

                arrHLS(2) = Rhino.ColorRGBToHLS(color(count2+2))

                'Call Rhino.Print(arrHLS(2)(1)/240)

                arrHLS(3) = Rhino.ColorRGBToHLS(color(count2+3))

                'Call Rhino.Print(arrHLS(3)(1)/240)                

                sum = Rhino.Sum(Array(arrHLS(0)(1)/240,arrHLS(1)(1)/240,arrHLS(2)(1)/240,arrHLS(3)(1)/240))

                ave = sum/4        

                arrFaceVerts(0) = Array(0,1,2,3)            

                arrMeshVerts = Array(arrFace2(0),arrFace2(1),arrFace2(2),arrFace2(3))

                arrVerticesNEW = arrMeshVerts            

                newMesh = Rhino.AddMesh(arrMeshVerts,arrFaceVerts)

                meshCent = Rhino.MeshAreaCentroid(newMesh)    

                count2 = count2 + 4            

            end if            

            Dim baseScaledAction : baseScaledAction = Rhino.ScaleObject(newMesh,meshCent,array(0.98,0.98,0.98))

            'Store the scaled baseMesh in the proper layer

            Call Rhino.ObjectLayer(baseScaledAction,strLayer5)

            'Create a polyline around the meshFace to avoid a tolerance issue

            Dim strPolyBase : strPolyBase = Rhino.AddPolyline(arrVerticesNEW)

            'Store the polyline in the proper layer

            Call Rhino.ObjectLayer(strPolyBase,strLayer6)

            'Create a new polyline(A) around the meshFace to avoid a tolerance issue

            Dim strPoly : strPoly = Rhino.AddPolyline(arrVerticesNEW)

            'Scale the polyline by 0.98 to create an edge ridge condition before any transformations are made

            strPoly = Rhino.ScaleObject(strPoly,meshCent,array(0.98,0.98,0.98))

            'Store the scaled polyLine in the proper layer

            Call Rhino.ObjectLayer(strPoly,strLayer13)

            'Create a copy of the new polyline(B) around the meshFace to avoid a tolerance issue

            Dim strPoly2 : strPoly2 = Rhino.AddPolyline(arrVerticesNEW)

            'Scale the polyline by 0.98 to create an edge ridge condition before any transformations are made

            strPoly2 = Rhino.ScaleObject(strPoly2,meshCent,array(0.98,0.98,0.98))

            'Store the scaled new polyLine in the proper layer

            Call Rhino.ObjectLayer(strPoly2,strLayer13)

            'Create another copy of the new polyline(C) around the meshFace to avoid a tolerance issue

            Dim strPoly3 : strPoly3 = Rhino.AddPolyline(arrVerticesNEW)

            'Scale the polyline by 0.98 to create an edge ridge condition before any transformations are made

            strPoly3 = Rhino.ScaleObject(strPoly3,meshCent,array(0.98,0.98,0.98))

            'Store the scaled new polyLine in the proper layer

            Call Rhino.ObjectLayer(strPoly3,strLayer13)

            '/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    

                        'FUNCTION INFORMATION ------------------------------------------------------------------------------------------

            '/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////        

            'Create Array to Store the BasePolyline(0.98 Scaled) and The SkinnyFrame Layer to pass to Function

            Dim arrCurveFrameOut : arrCurveFrameOut = array(strPolyBase,strPoly3)

            'Call the Quad Mesh Generating Function to Create the Skinny Frame (reason there is a 0,98 offset above)

            Call QuadUnfilletMeshGenerator(arrCurveFrameOut,strLayer14)    

            'Call StrandyPipe Function that makes the Radiant Cooling Pipes

            'Dim strandy : strandy = strandyPipeyAction(strPoly3,ave)

            'Put the Return from the function(Curves) and store them in the "StrandyDandy" Layer

            'Call Rhino.ObjectLayer(strandy,strLayer12)    

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            'if the luminance value is greater than 0 and less than 0,9 then do this

            If ave > 0 And ave < 0.9 Then

                'Scale the new Mesh over top of each existing mesh face

                Dim scaleMesh : scaleMesh = Rhino.ScaleObject(newMesh,meshCent,Array(ave,ave,ave))

                'store it in the offsetMesh Layer

                Call Rhino.ObjectLayer(scaleMesh,strLayer)

                'Get the meshFaceArea

                Dim meshArea1 : meshArea1 = Rhino.MeshArea(scaleMesh)

                'Call Rhino.Print(meshArea1(1))

                'scale the polyline(A) from the centroid by the luminance value

                Dim basescaleSrf : basescaleSrf = Rhino.ScaleObject(strPoly,meshCent,Array(ave,ave,ave))

                '/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                'POLYLINE MOVING ALONG MeshFace NORMAL BASED ON PAINT LUMINANCE VALUES

                                '/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                'VECTOR RELOCATION SET ------------------------------------------------

                'Get the meshfaceNormal

                Dim normal : normal = Rhino.MeshFaceNormals(newMesh)

                'Set the Move value at half the Luminance Value

                Dim pushValue : pushValue = ave * 0.5

                'Scale the vector to 0,5 units

                Dim normal2 : normal2 = Rhino.VectorScale(normal(0),-pushValue)

                'Add the point at the scaled vector

                Dim newVec : newVec = Rhino.PointAdd(meshCent,normal2)

                'Move the (0,98) scaled polyline from the centroid of the base meshface to the newVector Position

                Dim scaleSrf : scaleSrf = Rhino.MoveObject(basescaleSrf,meshCent,newVec)

                Call Rhino.ObjectLayer(scaleSrf,strLayer2)

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                'Create a temp polyline(A) copy to explode the hell out of

                Dim scaleSrfTemp : scaleSrfTemp = Rhino.ScaleObject(strPoly,meshCent,Array(1,1,1))

                Call Rhino.ObjectLayer(scaleSrfTemp,strLayer7)

                'Explode that hotness

                Dim explodeTest : explodeTest = Rhino.ExplodeCurves(scaleSrfTemp)    

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                'loop through the exploded hotness to store all the lenght values of the curve segments

                Dim z 

                For z = 0 To Ubound(explodeTest)    

                    ReDim Preserve lengthCheck(z)

                    lengthCheck(z) = Rhino.CurveLength(explodeTest(z))

                    'Call Rhino.Print(lengthCheck(z))

                Next

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                'If the length of a segment is less than 0,2 then do not fillet the curve 

                If lengthCheck(0) < 0.2 Or lengthCheck(1) < 0.2 Or lengthCheck(2) < 0.2 Or lengthCheck(3) < 0.2 Then

                    'Array containing polyline(B) and the moved along normal polyline to build out the meshFrame

                    Dim arrLoftCrvsB : arrLoftCrvsB = array(strPoly2,scaleSrf)

                    'Call the Quad Mesh Generating Function to Create the unfilleted meshFrame and put in the FrameDog2 Layer

                    Call QuadUnfilletMeshGenerator(arrLoftCrvsB,strLayer11)

                    'Create the infill Window for the frames that are unfilled

                    Dim offsetSolo : offsetSolo = Rhino.MeshPolyline(scaleSrfTemp)

                    'Store the window in the "OffsetSolo" Layer

                    Call Rhino.ObjectLayer(offsetSolo,strLayer10)

                Else

                    'If the length of a segment is greater than 0,2 then do this

'//////////////////////////////////////////////////////////////////////////////        

                    Dim arrLoftCrvs : arrLoftCrvs = array(scaleSrf,strPoly2)

                    'FUNCTION to FILLET-----------------------------------------------------------

                    Dim hotFillet : hotFillet = HotFilletAction(arrLoftCrvs,strLayer8,meshArea1(1),strLayer11)

'//////////////////////////////////////////////////////////////////////////////        

                    Call Rhino.DeleteObject(scaleSrf)

                    'Dim strlofty : strlofty = Rhino.AddLoftSrf(Array(hotFillet,strPoly2),,,0,0)

                    'Call Rhino.ObjectLayer(hotMeshAction,strLayer3)

                    Call Rhino.ObjectLayer(hotFillet,strLayer9)

                    'Call Rhino.SurfaceIsocurveDensity(hotSeamage,-1)

                End If

                Erase lengthCheck

            End If

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            'if the luminance value is greater than 0,9 Then

            If ave >= 0.9  Then

                'Scale the new Mesh over top of each existing mesh face

                Dim scaleMesh3 : scaleMesh3 = Rhino.ScaleObject(newMesh,meshCent,Array(ave-0.05,ave-0.05,ave-0.05))

                'store it in the offsetMesh Layer

                Call Rhino.ObjectLayer(scaleMesh3,strLayer)

                Dim meshArea2 : meshArea2  = Rhino.MeshArea(scaleMesh3)

                Dim basescaleSrf2 : basescaleSrf2 = Rhino.ScaleObject(strPoly,meshCent,Array(ave-0.05,ave-0.05,ave-0.05))

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                'VECTOR RELOCATION SET ------------------------------------------------

                Dim normal2A : normal2A = Rhino.MeshFaceNormals(newMesh)

                Dim pushValue2 : pushValue2 = (ave - 0.05) * 0.5

                Dim normal22 : normal22 = Rhino.VectorScale(normal2A(0),-pushValue2)

                Dim newVec2 : newVec2 = Rhino.PointAdd(meshCent,normal22)

                Dim scaleSrf3 : scaleSrf3 = Rhino.MoveObject(basescaleSrf2,meshCent,newVec2)

                Call Rhino.ObjectLayer(scaleSrf3,strLayer2)

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                scaleSrfTemp = Rhino.ScaleObject(strPoly,meshCent,Array(1,1,1))

                Call Rhino.ObjectLayer(scaleSrfTemp,strLayer7)            

                explodeTest = Rhino.ExplodeCurves(scaleSrfTemp)        

                Dim y 

                For y = 0 To Ubound(explodeTest)            

                    ReDim Preserve lengthCheck2(y)            

                    lengthCheck2(y) = Rhino.CurveLength(explodeTest(y))

                    'Call Rhino.Print(lengthCheck(z))            

                Next        

                If lengthCheck2(0) < 0.2 Or lengthCheck2(1) < 0.2 Or lengthCheck2(2) < 0.2 Or lengthCheck2(3) < 0.2 Then            

                    arrLoftCrvsB = array(strPoly2,scaleSrf3)                

                    Call QuadUnfilletMeshGenerator(arrLoftCrvsB,strLayer11)                

                    offsetSolo = Rhino.MeshPolyline(scaleSrfTemp)

                    Call Rhino.ObjectLayer(offsetSolo,strLayer10)                                    

                    'Call Rhino.ObjectLayer(scaleMesh,strLayer10)            

                    'Dim movedBase2 : movedBase2 = Rhino.MoveObject(scaleMesh3,meshCent,newVec)

                    'Call Rhino.ObjectLayer(movedBase2,strLayer10)

                    'strlofty = Rhino.AddLoftSrf(Array(strPoly2,scaleSrf3))

                    'Call Rhino.ObjectLayer(strLofty,strLayer11)

                    'Call Rhino.SurfaceIsocurveDensity(strlofty,-1)

                    'Call Rhino.ObjectLayer(scaleMesh3,strLayer10)                

                Else                            

                    'Dim hotFillet2 : hotFillet2 = HotFilletAction(scaleSrf3)            

                    'Call Rhino.DeleteObject(scaleSrf3)                

'/////////////////////////////////////////////////////////////////////////////    

                    arrLoftCrvs = array(scaleSrf3,strPoly2)

                    hotFillet = HotFilletAction(arrLoftCrvs,strLayer8,meshArea2(1),strLayer11)

                    'hotMeshAction = DirtyDirtyMeshGenerator(arrLoftCrvs)

                    'hotSeamage = HotSeamageAction(arrLoftCrvs)

'/////////////////////////////////////////////////////////////////////////////

                    Call Rhino.DeleteObject(scaleSrf3)

                    'strlofty = Rhino.AddLoftSrf(Array(strPoly2,scaleSrf3))

                    'Call Rhino.ObjectLayer(hotMeshAction,strLayer3)

                    Call Rhino.ObjectLayer(hotFillet,strLayer9)

                    'Call Rhino.SurfaceIsocurveDensity(hotSeamage,-1)

                    'Call Rhino.DeleteObjects(join3)                

                End If                

            End If                

            i = i + 4

            Erase arrFaceVertices2        

        Loop

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        Rhino.EnableRedraw True

    End If

    Call Rhino.LayerVisible(strLayer2,False)

    Call Rhino.LayerVisible(strLayer4,False)

    Call Rhino.LayerVisible(strMainLayer,False)

    Call Rhino.LayerVisible(strLayer6,False)

    Call Rhino.LayerVisible(strLayer,False)

    Call Rhino.LayerVisible(strLayer7,False)

    Call Rhino.LayerVisible(strLayer9,False)

End Sub



Function HotFilletAction(arrCrvs,layer,area,strLayer11)

    Dim curves

    Dim strOutterCrv

    curves = arrCrvs(0)

    strOutterCrv = arrCrvs(1)

    Dim arrOutterCrvPts : arrOutterCrvPts = Rhino.CurvePoints(strOutterCrv)

    Dim explodeAction : explodeAction = Rhino.ExplodeCurves(curves)

    Dim strNewLayer : strNewLayer = Rhino.AddLayer("fillet")

    Dim i

    Dim startPoints()

    Dim midPoints()

    Dim endPoints()

    Dim startPoints2()

    Dim endPoints2()

    Dim filletStorage()

    Dim arrFaceVertices2(0)

    Dim arrFaceVertices3(0)

    Dim arrVertForMesh

    Dim testArray

    'Rhino.Print area

    If area > 10 Then    

        Dim dblRadValue : dblRadValue = area/120    

    End If

    If area <= 10 And area > 6 Then

        dblRadValue = area/30

    End If

    If area <=  6 Then

        dblRadValue = area/40

    End If

    'Rhino.Print dblRadValue

    For i = 0 To Ubound(explodeAction)                

        arrFaceVertices2(0) = Array(0,1,2,2)    

        arrFaceVertices3(0) = Array(0,1,2,3)        

        If i = 3 Then        

            ReDim Preserve filletStorage(i)        

            filletStorage(i) = Rhino.AddFilletCurve(explodeAction(i),explodeAction(0),dblRadValue)

            'Call Rhino.ObjectLayer(fillet,strNewLayer)    

            ReDim Preserve startPoints(i)

            ReDim Preserve endPoints(i)        

            startPoints(i) = Rhino.CurveStartPoint(    filletStorage(i))        

            endPoints(i) = Rhino.CurveEndPoint(    filletStorage(i))        

'///////////////////////////////////////////////////////////////////////////////////////////

            Dim arrFilletDiv : arrFilletDiv = Rhino.DivideCurve(filletStorage(i),5)

            'Call Rhino.Print(arrFilletDiv(0)(0))

            Dim w

            For w = 0 To Ubound(arrFilletDiv) -1    

                'Call Rhino.AddLine(arrFilletDiv(y),arrOutterCrvPts(1))    

                arrVertForMesh = array(arrFilletDiv(w),arrFilletDiv(w+1),arrOutterCrvPts(0))    

                Dim FrameMesh : FrameMesh = Rhino.AddMesh(arrVertForMesh,arrFaceVertices2)    

                Call Rhino.ObjectLayer(FrameMesh,strLayer11)    

            Next

'///////////////////////////////////////////////////////////////////////////////////////////

        Else    

            ReDim Preserve filletStorage(i)    

            filletStorage(i) = Rhino.AddFilletCurve(explodeAction(i),explodeAction(i+1),dblRadValue)            

            If IsNull (filletStorage(i)) Then            

                Rhino.Print "something is fucked up"            

            End If        

            'Call Rhino.ObjectLayer(fillet,strNewLayer)        

'//////////////////////////////////////////////////////////////////////////////////////////

            arrFilletDiv = Rhino.DivideCurve(filletStorage(i),5)            

            'Call Rhino.Print(arrFilletDiv(0)(0))                

            Dim y

            For y = 0 To Ubound(arrFilletDiv) -1        

                'Call Rhino.AddLine(arrFilletDiv(y),arrOutterCrvPts(1))        

                If i = 0 Then            

                    arrVertForMesh = array(arrFilletDiv(y),arrFilletDiv(y+1),arrOutterCrvPts(1))            

                End If        

                If i = 1 Then            

                    arrVertForMesh = array(arrFilletDiv(y),arrFilletDiv(y+1),arrOutterCrvPts(2))        

                End If                

                If i = 2 Then                    

                    arrVertForMesh = array(arrFilletDiv(y),arrFilletDiv(y+1),arrOutterCrvPts(3))                

                End If                

                FrameMesh = Rhino.AddMesh(arrVertForMesh,arrFaceVertices2)                

                Call Rhino.ObjectLayer(FrameMesh,strLayer11)            

            Next    

'//////////////////////////////////////////////////////////////////////////////////////////    

            ReDim Preserve startPoints(i)        

            ReDim Preserve midPoints(i)            

            ReDim Preserve endPoints(i)                        

            startPoints(i) = Rhino.CurveStartPoint(filletStorage(i))            

            midPoints(i) = Rhino.CurveMidPoint(filletStorage(i))            

            'Call Rhino.AddTextDot(i,midPoints(i))        

            endPoints(i) = Rhino.CurveEndPoint(    filletStorage(i))    

        End If    

    Next

    Dim j    

    For j = 0 To Ubound(startPoints)    

        If j = 3 Then        

            ReDim Preserve filletStorage(i+j)        

            filletStorage(i+j) = Rhino.AddLine(endPoints(j),startPoints(0))

            'Call Rhino.ObjectLayer(newLine,strNewLayer)        

            testArray = array(endPoints(j),startPoints(0),arrOutterCrvPts(1),arrOutterCrvPts(0))

            'Call Rhino.ObjectLayer(newLine,strNewLayer)        

            Dim FrameMesh2 : FrameMesh2 = Rhino.AddMesh(testArray,arrFaceVertices3)

            Call Rhino.ObjectLayer(FrameMesh2,strLayer11)        

        Else    

            ReDim Preserve filletStorage(i+j)        

            filletStorage(i+j) = Rhino.AddLine(endPoints(j),startPoints(j+1))        

            testArray = array(endPoints(j),startPoints(j+1),arrOutterCrvPts(j+2),arrOutterCrvPts(j+1))

            'Call Rhino.ObjectLayer(newLine,strNewLayer)        

            FrameMesh2 = Rhino.AddMesh(testArray,arrFaceVertices3)        

            Call Rhino.ObjectLayer(FrameMesh2,strLayer11)

        End If        

    Next

    'Call Rhino.Print(Ubound(filletStorage))

    Dim strNewJoined : strNewJoined = Rhino.JoinCurves(filletStorage,True)

    Dim conv : conv = Rhino.ConvertCurveToPolyline(strNewJoined(0))

    'Call Rhino.ReverseCurve(conv)

    Call Rhino.DeleteObject(explodeAction(0))

    Call Rhino.DeleteObject(explodeAction(1))

    Call Rhino.DeleteObject(explodeAction(2))

    Call Rhino.DeleteObject(explodeAction(3))

    Call Rhino.DeleteObject(strNewJoined(0))

    Dim newOffsetFillet : newOffsetFillet = Rhino.MeshPolyline(conv)

    Call Rhino.ObjectLayer(newOffsetFillet,layer)

    HotFilletAction = conv

End Function



Function HotSeamageAction(hotFillet)

    

    Dim strObject(1),arrDomain, dblParameter,strObject2

    strObject(0) = hotFillet(0) 

    strObject(1) = hotFillet(1) 

    '    If Rhino.IsCurveClosed(strObject) Then

    arrDomain = Rhino.CurveDomain(hotFillet(0))

    dblParameter  = (arrDomain(0) + arrDomain(1)) / 2

    Dim eval : eval = Rhino.EvaluateCurve(hotFillet(0) ,dblParameter)    

    Call Rhino.AddPoint(eval)    

    Dim param2 : param2 = Rhino.CurveClosestPoint(hotFillet(1) ,eval)    

    Dim eval2 : eval2 = Rhino.EvaluateCurve(hotFillet(1) ,param2)    

    Call Rhino.AddPoint(eval2)    

    Rhino.CurveSeam hotFillet(0) , dblParameter    

    Rhino.CurveSeam hotFillet(1) , param2    

    'Dim crvCont : crvCont = array(strObject,strObject2)

    'End If

    Dim loftedAction : loftedAction = Rhino.AddLoftSrf(strObject)

    HotSeamageAction = loftedAction

End Function



Function QuadUnfilletMeshGenerator(meshCrvs,layer)

    Dim i,j,z,k

    Dim arrMeshVerts()

    Dim arrFaceVerts(0)

    arrFaceVerts(0) = array(0,1,2,3)

    Dim pts : pts = Rhino.CurvePoints(meshCrvs(0))

    Dim pts2 : pts2 = Rhino.CurvePoints(meshCrvs(1))

    For k = 0 To Ubound(pts)-1

        Dim meshArray : meshArray = array(pts(k),pts2(k),pts2(k+1),pts(k+1))

        Dim quadMeshy : quadMeshy = Rhino.AddMesh(meshArray,arrFaceVerts)    

        Call Rhino.ObjectLayer(quadMeshy,layer)    

    Next

End Function

Function reparameterize(crvy)

    'If Rhino.IsCurve(strSrfID) = True Then
    Call rhino.SelectObject(crvy)
    Call rhino.Command("reparameterize 0 1")
    Call rhino.UnselectAllObjects()
    'End If
End Function

Function strandyPipeyAction(strCrv,ave)
    Dim arrExp : arrExp = Rhino.ExplodeCurves(strCrv)
    Call Rhino.DeleteObjects(array(arrExp(2),arrExp(3)))
    If ave <= 0.5 Then    
        Call Rhino.DeleteObject(arrExp(2))
    End If

    If ave > 0.5 Then
        Call Rhino.DeleteObject(arrExp(0))
    End If
    strandyPipeyAction = arrExp
End Function

 

 

 

  • Share

Leave a reply

Your email address will not be published. Required fields are marked *