Gallery details
Code creates Machine Material Deposit Study
–Code was written during the Lunar Outpost [a] research thesis. The machine deposit represents the extracted material during the digging protocols. The base geometry is represented by a single line which represents the trajectory of the robot. Depending on the size and density required, the scale and density of the bundles + structure will adapt.–
RHINSCRIPT CODE
Option Explicit
'Script written by Luis Quinones
'Script copyrighted by YOUR ROBOT MOM
'Script version Sunday, January 31, 2010 10:01:33 PM
Call Main()
Sub Main()
'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'select test curve
Dim strCurve
Dim i
Dim arrPoints, arrPoint
Dim arrBaseC()
Dim arrPTsA()
Dim arrPTsB()
Dim arrPTsC()
Dim arrPTsD()
Dim arrPTsE()
Dim arrPTsF()
Dim dblPosX,dblPosY,dblPosZ
Dim count
Dim intFactorA
Dim dblCurveParam,arrData,arrTangent,arrNewPoint
Dim dblRad
'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
intFactorA = 72
intFactorA = 72/intFactorA
dblRad = .25
strCurve = Rhino.GetObject("Select Robot Poop Line",4)
If Rhino.IsCurve(strCurve) Then
Dim curvEnd : curvEnd = Rhino.CurveEndPoint(strCurve)
Dim Robot : Robot = rhino.addtextdot("ROBOT WEAVE",curvEnd)
Call Rhino.TextDotText(Robot,"ROBOT MATERIAL WEAVE")
Dim curvStart : curvStart = Rhino.CurveStartPoint(strCurve)
Dim Robot2 : Robot2 = rhino.addtextdot("ROBOT WEAVE_StepValue["& intFactorA & "]",curvStart)
'Call Rhino.TextDotText(Robot2,"Weave_Error Fix Mode")
'extract the curve points
arrPoints = Rhino.DivideCurve(strCurve,100)
If IsArray(arrPoints) Then
Dim intStep : intStep = intFactorA
Dim intOffset : intOffset = intStep/(intStep*50)
Dim dblConv : dblConv = 0.0174532925
For i = 0 To 20 Step intStep
Dim dblRadius : dblRadius = i*3
count = 0
For Each arrPoint In arrPoints
If IsArray(arrPoint) Then
dblCurveParam = Rhino.CurveClosestPoint(strCurve, arrPoint)
If IsNumeric(dblCurveParam) Then
arrData = Rhino.CurveCurvature(strCurve, dblCurveParam)
If IsArray(arrData) Then
arrTangent = arrData(1)
arrNewPoint = array((arrPoint(0)+arrTangent(0)),(arrPoint(1)+arrTangent(1)),(arrPoint(2)+arrTangent(2)))
End If
End If
End If
ReDim Preserve arrBaseC(count)
ReDim Preserve arrPTsA(count)
ReDim Preserve arrPTsB(count)
ReDim Preserve arrPTsC(count)
ReDim Preserve arrPTsD(count)
ReDim Preserve arrPTsE(count)
ReDim Preserve arrPTsF(count)
'reference (x.y.z) values
dblPosX = arrNewPoint(0)
dblPosY = arrNewPoint(1)
dblPosZ = arrNewPoint(2)
'returns the remainder of a division operation. For example, 5%2 equals 1 because dividing 5 by 2 gives 2 and the remainder is 1, which is the value returned from this expression.
If count Mod 2 = 0 Then
'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
arrBaseC(count) = PointCoordinates(Rhino.AddPoint(array(dblPosX,dblPosY,dblPosZ)))
arrPTsC(count) = PointCoordinates(Rhino.AddPoint(array(cos((i+intOffset)*count*dblConv)*dblRadius+dblPosX, dblPosY, (sin((i+intOffset)*count*dblConv)*dblRadius)*-1+dblPosZ)))
arrPTsD(count) = PointCoordinates(Rhino.AddPoint(array(sin((i-intOffset)*count*dblConv)*dblRadius+dblPosX, dblPosY, (cos((i-intOffset)*count*dblConv)*dblRadius)*-1+dblPosZ)))
Call Rhino.AddLine( arrPTsC(count), arrBaseC(count))
Else
arrBaseC(count) = PointCoordinates(Rhino.AddPoint(array(dblPosX,dblPosY,dblPosZ)))
arrPTsC(count) = PointCoordinates(Rhino.AddPoint(array(cos((i+intOffset)*count*dblConv)*dblRadius+dblPosX, dblPosY, (sin((i+intOffset)*count*dblConv)*dblRadius)*-1+dblPosZ)))
arrPTsD(count) = PointCoordinates(Rhino.AddPoint(array(sin((i-intOffset)*count*dblConv)*dblRadius+dblPosX, dblPosY, (cos((i-intOffset)*count*dblConv)*dblRadius)*-1+dblPosZ)))
Call Rhino.AddLine( arrPTsD(count), arrBaseC(count))
'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
End If
count = count + 1
Next
'Call Rhino.AddInterpCurve(arrPTsA)
'Dim strCurveA : strCurveA = Rhino.AddInterpCurve(arrPTsA)
'Call Rhino.ObjectColor (strCurveA,RGB (255,255,255))
'Call Rhino.AddLayer("ISH_A",RGB(255,120,100))
'Call Rhino.ObjectLayer(strCurveA,"ISH_A")
'Call Rhino.AddInterpCurve(arrPTsB)
'Dim strCurveB : strCurveB = Rhino.AddInterpCurve(arrPTsB)
Dim strCurveC : strCurveC = Rhino.AddInterpCurve(arrPTsC)
Call Rhino.ObjectColor (strCurveC,RGB (255,255,255))
Call Rhino.AddLayer("ISH_C",RGB(255,120,100))
Call Rhino.ObjectLayer(strCurveC,"ISH_C")
'Call Rhino.AddInterpCurve(arrPTsD)
Dim strCurveD : strCurveD = Rhino.AddInterpCurve(arrPTsD)
Call Rhino.ObjectColor (strCurveD,RGB (255,120,90))
Call Rhino.AddLayer("ISH_D",RGB(255,255,255))
Call Rhino.ObjectLayer(strCurveD,"ISH_D")
'Dim strCurveE : strCurveE = Rhino.AddInterpCurve(arrPTsE)
'Call Rhino.ObjectColor (strCurveE,RGB (255,120,90))
'Call Rhino.AddLayer("ISH_3",RGB(120,100,255))
'Call Rhino.ObjectLayer(strCurveE,"ISH_E")
'Dim strCurveF : strCurveF = Rhino.AddInterpCurve(arrPTsF)
'Call Rhino.ObjectColor (strCurveF,RGB (255,120,90))
'Call Rhino.AddLayer("ISH_F",RGB(120,100,255))
'Call Rhino.ObjectLayer(strCurve4,"ISH_F")
Call AddPipe(arrPTsC,dblRad,i) : Call AddPipe(arrPTsD,dblRad,i)
'select the 2nd to last curve from strCurveC to use
If i = 19 Then
Call Rhino.AddLayer("LastCurve",RGB(100,100,100))
Call Rhino.ObjectLayer(strCurveC,"LastCurve")
End If
'select the last to last curve from strCurveC to use
If i = 20 Then
'Call Rhino.AddLayer("LastCurve2",RGB(100,100,100))
Call Rhino.ObjectLayer(strCurveD,"LastCurve")
End If
Dim strPoopCurves : strPoopCurves = Rhino.ObjectsByLayer("LastCurve",True)
Next
Call PoopBracket(strPoopCurves)
End If
End If
End Sub
Function AddPipe(arrMovPta,dblRad,k)
Dim strLine, strPipe
strLine = Rhino.AddInterpCurve (arrMovPta)
Call Rhino.SelectObject (strLine)
Call Rhino.Command ("Pipe "&dblRad&" "&dblRad&" enter")
strPipe = Rhino.LastObject
Call Rhino.ObjectColor (strPipe, rgb(0,k,0))
Call Rhino.Command ("Selnone ")
Call Rhino.DeleteObject (strLine)
End Function
Function PoopBracket(strPoopCurves)
Dim strPoopCurve
Dim count3
count3 = 0
For Each strPoopCurve In strPoopCurves
Dim strPoopCurve2 : strPoopCurve2 = Rhino.ObjectsByLayer("LastCurve",True)
If IsNull(strPoopCurve2) Then Exit Function
Dim crvObject2 : crvObject2 = strPoopCurve2(count3)
Dim intSteps : intSteps = 60
If IsNull(intSteps) Then Exit Function
Dim dblRad2 : dblRad2 = 1
If IsNull(dblRad2) Then Exit Function
Dim crvDomain : crvDomain = Rhino.CurveDomain(crvObject2)
Dim t, count
If count3 = 0 Then
Dim arrCrossSections(), CrossSectionPlane
Dim crvCurvature, crvPoint, crvTangent, crvPerp, crvNormal
count = 0
For t = crvDomain(0) To crvDomain(1) + 1e-9 Step (crvDomain(1)-crvDomain(0))/intSteps
crvCurvature = Rhino.CurveCurvature(crvObject2, t)
'If IsNull(crvCurvature) Then
'crvPoint = Rhino.EvaluateCurve(crvObject, t)
'crvTangent = Rhino.CurveTangent(crvObject, t)
'crvPerp = Array(0,0,1)
'crvNormal = Rhino.VectorCrossProduct(crvTangent, crvPerp)
' Else
crvPoint = crvCurvature(0)
crvTangent = crvCurvature(1)
crvPerp = Rhino.VectorUnitize(crvCurvature(4))
crvNormal = Rhino.VectorCrossProduct(crvTangent, crvPerp)
'Dim strPoint : strPoint = Rhino.AddPoint(crvNormal)
'Call Rhino.ObjectColor(strPoint,RGB(255,255,255))
CrossSectionPlane = Rhino.PlaneFromFrame(crvPoint, crvPerp, crvNormal)
ReDim Preserve arrCrossSections(count)
Dim dblRad3 : dblRad3 = dblRad2*cos(count*10)
If dblRad3 < .25 Then
dblRad3 = dblRad2 * 5
Else
dblRad3 = dblRad2*cos(count*10)
End If
arrCrossSections(count) = Rhino.AddCircle(CrossSectionPlane, dblRad3)
count = count + 1
Next
Else
Dim arrCrossSections1()
count = 0
For t = crvDomain(0) To crvDomain(1) + 1e-9 Step (crvDomain(1)-crvDomain(0))/intSteps
crvCurvature = Rhino.CurveCurvature(crvObject2, t)
'If IsNull(crvCurvature) Then
'crvPoint = Rhino.EvaluateCurve(crvObject, t)
'crvTangent = Rhino.CurveTangent(crvObject, t)
'crvPerp = Array(0,0,1)
'crvNormal = Rhino.VectorCrossProduct(crvTangent, crvPerp)
' Else
crvPoint = crvCurvature(0)
crvTangent = crvCurvature(1)
crvPerp = Rhino.VectorUnitize(crvCurvature(4))
'Call Rhino.AddPoint(crvPerp)
crvNormal = Rhino.VectorCrossProduct(crvTangent, crvPerp)
'Dim strPoint : strPoint = Rhino.AddPoint(crvNormal)
'Call Rhino.ObjectColor(strPoint,RGB(255,255,255))
'End If
'origin, x axis, y axis
CrossSectionPlane = Rhino.PlaneFromFrame(crvPoint, crvPerp, crvNormal)
ReDim Preserve arrCrossSections1(count)
dblRad3 = dblRad2*cos(count*10)
If dblRad3 < .25 Then
dblRad3 = dblRad2 * 5
Else
dblRad3 = dblRad2*cos(count*10)
End If
arrCrossSections1(count) = Rhino.AddCircle(CrossSectionPlane, dblRad3)
count = count + 1
Next
End If
If count < 1 Then Exit Function
If count3 = 0 Then
Dim strRobotPoopSrf : strRobotPoopSrf = Rhino.AddLoftSrf(arrCrossSections)
Call Rhino.AddLayer("Robot_Mini_PooP")
Call Rhino.ObjectLayer(strRobotPoopSrf,"Robot_Mini_PooP")
Call Rhino.AddLayer("Robot_Mini_PooP_curves",RGB(255,255,255))
Call Rhino.CurrentLayer("Robot_Mini_PooP_curves")
Call Rhino.ObjectsByLayer("Robot_Mini_PooP",True)
Call Rhino.Command("extractwireframe")
Call Rhino.LayerVisible ("Robot_Mini_PooP",False)
Dim dblRad : dblRad = .5
Dim arrPoopCrvs : arrPoopCrvs = Rhino.ObjectsByLayer("Robot_Mini_PooP_curves")
'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Dim arrPoopCrv,count1
count1 = 0
For Each arrPoopCrv In arrPoopCrvs
Dim strCurrentCurve : strCurrentCurve = Rhino.SelectObject(arrPoopCrvs(count1))
Call Rhino.Command ("Pipe "&dblRad&" "&dblRad&" enter")
strCurrentCurve = Rhino.LastObject
Call Rhino.ObjectColor (strCurrentCurve, rgb(255,255,255))
Call Rhino.Command ("Selnone ")
Call Rhino.DeleteObject (strCurrentCurve)
count1 = count1 + 1
Next
count3 = count3 + 1
Else
Dim strRobotPoopSrf2 : strRobotPoopSrf2 = Rhino.AddLoftSrf(arrCrossSections1)
Call Rhino.AddLayer("Robot_Mini_PooP2")
Call Rhino.ObjectLayer(strRobotPoopSrf2,"Robot_Mini_PooP2")
Call Rhino.AddLayer("Robot_Mini_PooP_curves2",RGB(255,255,255))
Call Rhino.CurrentLayer("Robot_Mini_PooP_curves2")
Call Rhino.ObjectsByLayer("Robot_Mini_PooP2",True)
Call Rhino.Command("extractwireframe")
Call Rhino.LayerVisible ("Robot_Mini_PooP2",False)
dblRad = .5
arrPoopCrvs = Rhino.ObjectsByLayer("Robot_Mini_PooP_curves2")
'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
count1 = 0
For Each arrPoopCrv In arrPoopCrvs
strCurrentCurve = Rhino.SelectObject(arrPoopCrvs(count1))
Call Rhino.Command ("Pipe "&dblRad&" "&dblRad&" enter")
strCurrentCurve = Rhino.LastObject
Call Rhino.ObjectColor (strCurrentCurve, rgb(255,255,255))
Call Rhino.Command ("Selnone ")
Call Rhino.DeleteObject (strCurrentCurve)
count1 = count1 + 1
Next
count3 = count3 + 1
'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
End If
Next
End Function
Update
Recently in Portfolio
- [K]ernels

- Nike A.I.R Prototypes

- [A]nisochromatic Meshing

- Nike After Dark Tour

- PARAPRAXIS

- [001.HRR] CONCEPT BIKE

- 2040:LUNAR.OUTPOST[a]

- HE.6 2020 Prototype

- CULEBRA.NET

- PYTORCH-CLASSIFIER

- Nike Zoom Superfly Elite

- BENGBU CITY OPERA

- Nike Footscape Flyknit DM

- Jordan Hyperdunk React

- KA-HELMET

- [C]ucarachas

- [S]eeker

- [O]h Baby

- [E]l Papa

- [S]hatter.Brain

- [S]tigmergy

- [F]orces

- CULEBRA.JAVA

- [C]ulebra.MultiBehaviors

- [S]ticky Stuff

- [S]entinels

- [G]allopingTopiary

- RELUXOED

- [SRC] . Semi Rigid Car

- [P]erlin

- [E]ternal Wanderers

- [W]heelie

- [S]labacube

- [M]esh Crawlers

- [L]a Silla

- [3]D BabyMaking Trackstars

- [3]D Trackers

- [2]D BabyMaking Trackers

- [T]rackers

- CULEBRA GRASSHOPPER

- culebra.[M]eshCrawlers.3D

- culebra.[H]ybrid.3D

- culebra.[F]lorgy

- culebra.[F]ockers.3D

- culebra.[F]ockers.2D

- culebra.[N]oisey.3D

- [E]l Nino

- culebra.[S]elfOrg

- [D]rippin

- culebra.[N]oisey.2D

- [C]reepyCrawlers

- [J]eepresesCreepers

- [T]2000

- PUFFER PLEATNESS

- EMERGEN[CY]

- [L]iquified

- [S]uckedComp

- [X]plosion

- MR. EW

- [H]airGoo

- [B]alled

- [n]injaStars

- [b]loomer

- [t]rip city

- TAPE GUNNED

- [B]oom

- [M]iller Time

- [D]elamjam

- [B]rain Zapper

- [B]ig Bird

- [E]gg Tube Pavillion

- [A]llice’s Easter Tree

- [S]weet Honey

- [U]M.Urgent

- [t]oo.urgent

- [B]onnie..+..Clyde

- [B]io Mess

- [EL]Mojado.Virus

- [W]HAT the …!

- [H]ot Lava

- [P]leat Diddy

- [t]erminator easter egg

- Mr. BB

- [B]less You

- [F]antastic + Interactive

- [S]oo_Minimally_Pathed

- [P]uffer Fish.Fab

- [M]an Eater

- [AHH] Alien House Hunters

- [W]eave Machine

- Sportbike Racing

- Grappling

- Kart Racing


Leave a reply