‘ RhinoScript ’ category archive

Mar
25

Sub-Dividing

Jan
21

Fibrous Art Bridge

These are some images from a recently finished competition.

Jan
04

Fibers 2

Ordered, but random
Random, but ordered

Dec
17

Fibers

Recent explorations on fibrous structures

a

b

c

Aug
30

Pixel-scape

4b

1b

2b

3b

I have been exploring this idea of a pixelated landscape. Possibly, a park composed with a few types of regular components like grass, walkways, bench, water, light, etc. A controllable intensity of randomness is introduced. This is an attempt to create a simple green surface with a walkway defined by a curve. The curve attracts/selelcts the points according to its defined weight.

screenshobt

Jul
22

Attracted Flows

4a

3a

This is a rhinoscript where you can set various points where vectors flow out from according to a certain velocity. As these vectors travel, the flows are attracted to the various attractor points in different weights three dimensionally. It simulates a close logic to the emitted particles being attracted to newton forces in Maya.

1

2

—-

Option Explicit
‘Script written by Howard Jiho Kim / crtl-i.com
Call Main()
Sub Main()
Dim startPt, velocity
velocity = Array(10,0,0)
startPt = Rhino.GetObjects(“Select Start Points”,1)
‘Attractors / Distances
Dim no_attr, attr, attrStr, i
no_attr = Rhino.GetInteger(“How many attractors?”)
ReDim attr(no_attr-1), attrStr(no_attr-1)
For i=0 To no_attr-1
attr(i) = Rhino.GetObject(“Select Attractor ” & (i+1),1)
attrStr(i) = Rhino.GetReal(“Enter Strength for Attractor ” & (i+1))
Next
For i=0 To Ubound(startPt)
Flow velocity, startPt(i), no_attr, attr, attrStr, 35
Next
End Sub
Function Flow(velocity, startPt, no_attr, attr, attrStr, gens)
Dim vec1, vec0
vec1 = Rhino.VectorCreate(velocity, Array(0,0,0))
vec0 = Rhino.VectorCreate(Rhino.PointCoordinates(startPt), Array(0,0,0))
Dim totalDistance, distance, i
ReDim distance(no_attr-1)
Dim vec, finalVec, vec4, tagStop
tagStop = 0
ReDim vec(no_attr-1)
Dim newPt, newLine, endPt2
totalDistance=0
If gens>0 Then
For i=0 To no_attr-1
distance(i) = Rhino.Distance(Rhino.PointCoordinates(startPt), Rhino.PointCoordinates(attr(i)))
totalDistance = totalDistance + distance(i)
Rhino.Print distance(i)
Rhino.Print totalDistance
If distance(i) < 1 Then
gens = -1
End If
Next
‘Vectors
vec4 = vec1
For i=0 To no_attr-1
vec(i) = Rhino.VectorCreate(Rhino.PointCoordinates(attr(i)), Rhino.PointCoordinates(startPt))
vec(i) = Rhino.VectorUnitize(vec(i))
vec(i) = Rhino.VectorScale(vec(i), (attrStr(i)/distance(i))^2)
vec4 = Rhino.VectorAdd(vec4, vec(i))
Next
finalVec = Rhino.VectorUnitize(vec4)
finalVec = Rhino.VectorScale(finalVec, 1)
If tagStop = 0 Then
newPt = Rhino.AddPoint(finalVec)
newLine = Rhino.AddLine(Array(0,0,0), finalVec)
endPt2 = Rhino.MoveObject(newPt, vec0)
newLine = Rhino.MoveObject(newLine, vec0)
End If
Flow velocity, endPt2, no_attr, attr, attrStr, gens-1
End If
End Function

Option Explicit

‘Script written by Howard Jiho Kim / crtl-i.com

Call Main()

Sub Main()

Dim startPt, velocity

velocity = Array(10,0,0)

startPt = Rhino.GetObjects(“Select Start Points”,1)

‘Attractors / Distances

Dim no_attr, attr, attrStr, i

no_attr = Rhino.GetInteger(“How many attractors?”)

ReDim attr(no_attr-1), attrStr(no_attr-1)

For i=0 To no_attr-1

attr(i) = Rhino.GetObject(“Select Attractor ” & (i+1),1)

attrStr(i) = Rhino.GetReal(“Enter Strength for Attractor ” & (i+1))

Next

For i=0 To Ubound(startPt)

Flow velocity, startPt(i), no_attr, attr, attrStr, 35

Next

End Sub

Function Flow(velocity, startPt, no_attr, attr, attrStr, gens)

Dim vec1, vec0

vec1 = Rhino.VectorCreate(velocity, Array(0,0,0))

vec0 = Rhino.VectorCreate(Rhino.PointCoordinates(startPt), Array(0,0,0))

Dim totalDistance, distance, i

ReDim distance(no_attr-1)

Dim vec, finalVec, vec4, tagStop

tagStop = 0

ReDim vec(no_attr-1)

Dim newPt, newLine, endPt2

totalDistance=0

If gens>0 Then

For i=0 To no_attr-1

distance(i) = Rhino.Distance(Rhino.PointCoordinates(startPt), Rhino.PointCoordinates(attr(i)))

totalDistance = totalDistance + distance(i)

Rhino.Print distance(i)

Rhino.Print totalDistance

If distance(i) < 1 Then

gens = -1

End If

Next

‘Vectors

vec4 = vec1

For i=0 To no_attr-1

vec(i) = Rhino.VectorCreate(Rhino.PointCoordinates(attr(i)), Rhino.PointCoordinates(startPt))

vec(i) = Rhino.VectorUnitize(vec(i))

vec(i) = Rhino.VectorScale(vec(i), (attrStr(i)/distance(i))^2)

vec4 = Rhino.VectorAdd(vec4, vec(i))

Next

finalVec = Rhino.VectorUnitize(vec4)

finalVec = Rhino.VectorScale(finalVec, 1)

If tagStop = 0 Then

newPt = Rhino.AddPoint(finalVec)

newLine = Rhino.AddLine(Array(0,0,0), finalVec)

endPt2 = Rhino.MoveObject(newPt, vec0)

newLine = Rhino.MoveObject(newLine, vec0)

End If

Flow velocity, endPt2, no_attr, attr, attrStr, gens-1

End If

End Function

Jul
06

Facade Studies

Some facade studies. All these patterns are made through a version of script that is very close to the 3D-pixelate code.

090706_type_f

1

3

4

Jun
29

3D – Pixelate

render2

This is a script that pixelates point clouds into a user-defined 3-dimensional grid. It also arrays same size boxes to the pixelated points. If used wisely, it could become a good tool to rationalize a nurb surface into many small boxes.

pixelate

It first pixelates the points into a wanted grid. Naturally, the geometry starts to lose its shape as the pixelating factor grows.

render

Then it populates the points with a box that you define.

—–

Option Explicit

‘Script written by Howard Jiho Kim / crtl-i.com

Sub Pixelate

Dim strObject, arrPoint, arrObjects, box_pt(7), box

arrObjects = Rhino.GetObjects(“Select points to pixelate”)

Dim multiplier_x, m1_x, m2_x, finalHeight_x, arrEnd(2)

multiplier_x = Rhino.GetReal(“Enter Pixelating Factor for X axis (0 for Non-Pixelation): “)

Dim multiplier_y, m1_y, m2_y, finalHeight_y

multiplier_y = Rhino.GetReal(“Enter Pixelating Factor for Y axis (0 for Non-Pixelation): “)

Dim multiplier_z, m1_z, m2_z, finalHeight_z

multiplier_z = Rhino.GetReal(“Enter Pixelating Factor for Z axis (0 for Non-Pixelation): “)

Dim box_yn

box_yn = Rhino.GetInteger(“Create boxes? (1-Yes, 2-No)”)

If box_yn = 1 Then

Dim box_x, box_y, box_z, box_mid_pt(2)

box_x = Rhino.GetReal(“Enter Box size-x: “)

box_y = Rhino.GetReal(“Enter Box size-y: “)

box_z = Rhino.GetReal(“Enter Box size-z: “)

box_pt(0) = Array(0,0,0)

box_pt(1) = Array(box_x,0,0)

box_pt(2) = Array(box_x,box_y,0)

box_pt(3) = Array(0,box_y,0)

box_pt(4) = Array(0,0,box_z)

box_pt(5) = Array(box_x,0,box_z)

box_pt(6) = Array(box_x,box_y,box_z)

box_pt(7) = Array(0,box_y,box_z)

box_mid_pt(0) = box_x/2

box_mid_pt(1) = box_y/2

box_mid_pt(2) = box_z/2

box = Rhino.AddBox(box_pt)

End If

If Not IsNull(arrObjects) Then

For Each strObject In arrObjects

arrPoint=Rhino.PointCoordinates(strObject)

Rhino.Print Rhino.Pt2Str(arrPoint, 3)

If multiplier_x > 0 Then

m1_x = arrPoint(0) / multiplier_x

m1_x = Rhino.Floor(m1_x)

m2_x = (arrPoint(0) – (m1_x*multiplier_x))*2

If m2_x > multiplier_x Then m1_x = m1_x+1

finalHeight_x = m1_x * multiplier_x

arrEnd(0) = finalHeight_x

ElseIf multiplier_x=0 Then

arrEnd(0) = arrPoint(0)

End If

If multiplier_y > 0 Then

m1_y = arrPoint(1) / multiplier_y

m1_y = Rhino.Floor(m1_y)

m2_y = (arrPoint(1) – (m1_y*multiplier_y))*2

If m2_y > multiplier_y Then m1_y = m1_y+1

finalHeight_y = m1_y * multiplier_y

arrEnd(1) = finalHeight_y

ElseIf multiplier_y=0 Then

arrEnd(1) = arrPoint(1)

End If

If multiplier_z > 0 Then

m1_z = arrPoint(2) / multiplier_z

m1_z = Rhino.Floor(m1_z)

m2_z = (arrPoint(2) – (m1_z*multiplier_z))*2

If m2_z > multiplier_z Then m1_z = m1_z+1

finalHeight_z = m1_z * multiplier_z

arrEnd(2) = finalHeight_z

ElseIf multiplier_z=0 Then

arrEnd(2) = arrPoint(2)

End If

Rhino.MoveObject strObject, arrPoint, arrEnd

If box_yn = 1 Then

Rhino.CopyObject box, box_mid_pt, arrEnd

End If

Next

If box_yn = 1 Then

Rhino.DeleteObject box

End If

End If

End Sub

Pixelate

Feb
16

Diffuse Curve

This is a RhinoScript that I wrote about a few months ago in: http://crtl-i.com/blog/2008/12/diffuse-noise/

It will take a curve and diffuse it into many curves according to a few parameters:
devRate: deviation rate
vecLenMax: maximum length of a particle
vecLenMin: minimum length of a particle
noParticle: number of total particles

If vecLenMax and vecLenMin are the same, all the particles will have the same length. 

Option Explicit

Call Diffuse()

 

Sub Diffuse()

 

Dim devRate : devRate = 0.01

Dim vecLenMax : vecLenMax = 1

Dim vecLenMin : vecLenMin = 3

Dim noParticle : noParticle = 100

 

Dim aCrvs : aCrvs = Rhino.GetObjects(“Select Curves”, 4)

 

Dim i,n

Dim aPts()

Dim crvDom, crvParam, crvLen

Randomize

For i = 0 To UBound(aCrvs)

 

n = 0

Dim strCrv : strCrv = aCrvs(i)

 

crvDom = Rhino.CurveDomain(strCrv)

crvLen = Rhino.CurveLength(strCrv)

 

Rhino.EnableRedraw False

 

Do Until n = noParticle

 

crvParam = (RN(0.00, 1.00)) * (crvDom(1))

 

ReDim Preserve aPts(n)

aPts(n) = Rhino.EvaluateCurve(strCrv, crvParam)

Dim devPt : devPt = aPts(n)

Dim devX : devX = crvLen * devRate * RN(-1,1) + devPt(0)

Dim devY : devY = crvLen * devRate * RN(-1,1) + devPt(1)

Dim devZ : devZ = crvLen * devRate * RN(-1,1) + devPt(2)

Dim devPt2 : devPt2 = Array(devX, devY, devZ)

Dim rndPt : rndPt = Array(RN(-1,1), RN(-1,1), RN(-1,1))

Dim rndPt2 : rndPt2 = Rhino.PointAdd(devPt2, rndPt)

 

If n >= 1 Then

Dim vecDir : vecDir = Rhino.AddLine(devPt2, rndPt2)

Dim vecLen : vecLen = RN(vecLenMin, vecLenMax)

Dim Xform : Xform = Rhino.XformScale(devPt2, vecLen)

Rhino.TransformObject vecDir, Xform, True

End If

 

n = n + 1

 

Loop

 

Rhino.EnableRedraw True

Next

End Sub

 

Function RN (nMin, nMax)

RN = Null

Randomize

RN = (nMax – nMin) * Rnd + nMin

End Function

Feb
12

Avicular Colonies

 

This is what we submitted for the Evolo Skyscraper competition. Our design imagines of a world where birds evolve to nest skyscrapers. We didn’t end up winning any prizes, but it was a fun process nonethless. You can view the winners at: evolo-arch.com

dsample-01-noise-mesh-array

ff

growh

section

materials

2_final

 

Our final boards can be viewed here:

0223 02232

 

Concept Statement:

This is a proposal for a skyscraper that perhaps will emerge in the near future, which will surface without the contribution of human effort.  Although it will be the unintended side effect of technological progress, and therefore can ultimately be considered the result of human activity. It is a skyscraper nested by birds, out of man-made materials including cars, missiles, buses and tanks and other detritus of the human population. Our materialist and capitalist society tells us that if it is economical and convenient enough, then it is permissible to destroy nature and wipe out natural habitats. Will nature’s environmental refugees continue to face extinction, or, as this structure proposes, will they innovate in their adaptation to survive in this world that is changing faster than ever?

Birds are known to be incredibly capable of adapting to adverse environments. They have continued to evolve in human habitats (or habitats that men have taken over) and have become stronger. Bower birds recognize plastic and metal scraps and decorate their nests with bottle caps, straws and other trash thrown away by people.  Many species have adapted their wings to maneuver through tall skyscrapers and they have become comfortable dwelling within the human-made architectural spaces. They are becoming like us. Male Lyre birds imitate the sounds of their environment in order to attract a mate, even if those sounds include man-made noises such as sounds of camera shutters, car alarms, or the high-powered chain saws of foresters intent on destroying their habitat of trees.

What next? If they learn to flock in bigger colonies and learn to use heavier materials for building their nests, being the excellent architects they already are, what could limit them? To imagine birds building skyscrapers out of humanity’s disposable culture seems laughable. But history is full of ideas and inventions that sounded ridiculous at the moment. Who would have imagined thousands of years ago, when people used to live in huts built of mud and straw, that one day, there would be towering skyscrapers filling the sky? Just as mankind started constructing taller buildings to accommodate the growing population and crowded living conditions, birds, the master builders, will soon need to implement a new typology of nesting as their survival mechanism. As they are losing surface area, birds will need to start extending vertically for higher density. In fact, it is their very anatomic design which defies gravity, that allows them to reside in vertical structures better than human beings, who were designed to circulate merely on two dimensions.

The evolved skyscraping nests will emerge in a few selective areas where birds still recognize as their habitats. An ideal place for the avicular colonies to build their first structures would be the demilitarized zones, where wildlife is unintentionally reserved. There is a long stretch of this DMZ in Korea, the Korean Demilitarized Zone, separating the Korean peninsula in half. Humans have not entered this land for half a century. Unlike the other places in the world, more and more non-human species thrive in the DMZ. It is ironic to see how animals have found their own little Eden in between the war zones. The avicular colony will build an ineffably grand skyscraper and it will be created with piles upon piles of men’s failed dreams and broken hopes in preserving this earth.

Jan
05

Random / Order – Growth

I recently purchased a book which turned out to be one of the most amazing books I have ever come across: “A New Kind of Science” by Stephen Wolfram. The entire book is available online for viewing at: http://www.wolframscience.com/nksonline/toc.html

I have been reading a chapter on randomness, which is why I have been writing scripts that heavily depends on random number generator. These are the results of a growth algorithm that explores a territory that is somewhere in between being random and ordered. 

Dec
21

Diffuse / Noise

A new script that I have been writing based on a script found in: 
http://ncertainties3.wordpress.com/explicit-protocols/adam/181008_weldedwire/

The script diffuses any curve into smaller pieces of lines depending on a few parameters.

Merry Christmas, btw :)

 

Some tests:

 

Dec
08

Colony

This is still under a lot of progress. Just exploring ways to randomly populate a surface with mesh objects in this case with bikes and tanks.

Jun
18

Two Surface Space Frame (Rhino Explicit History)

space frame

Ah so, the new version of the Explicit History plug-in for Rhino is out. http://grasshopper.rhino3d.com. It’s going to be a cool new toy to play with :)

This is another way of creating space frames using U/V divisions from two surfaces. Almost the same thing as the previous post. Very simple.

crtli_gh_space_frame.wrm
crtli_gh_space_frame.3dm

Jun
09

Polyline Network Surface

poly network surface

This is a handy script for those that use NetworkSrf extensively. NetworkSrf is probably one of the coolest things that Rhino offers for nurbs modelling. Just make some polylines in a way that has U/V organization and hit the script.

Option Explicit
‘Script written by Howard Jiho Kim
‘Script version Monday, March 10, 2008 12:46:21 PM

Call Main()
Sub Main()

Dim strObject, strObject2, arrObjects
Dim netCrv(100)
Dim i
Dim arrNew
i=0

arrObjects = Rhino.GetObjects(“Pick some curves”, 4)

If IsArray(arrObjects) Then

For Each strObject In arrObjects

If Rhino.IsPolyline(strObject) Then
netCrv(i) = SubDividePolyline(strObject)
Print netCrv(i)
Rhino.SelectObject netCrv(i)
i=i+1
End If

Next

End If

Rhino.Command(“NetworkSrf”)

End Sub

Function SubDividePolyline(strObject)
Dim arrV
arrV = Rhino.PolylineVertices(strObject)
Dim arrSubD() : ReDim arrSubD(2 * UBound(arrV))
Dim i

For i=0 To UBound(arrV)-1

arrSubD(i*2) = arrV(i)
arrSubD(i*2+1) = Array( (arrV(i)(0) + arrV(i+1)(0))/ 2.0, _
(arrV(i)(1) + arrV(i+1)(1))/ 2.0, _
(arrV(i)(2) + arrV(i+1)(2))/ 2.0)
Next

arrSubD(UBound(arrSubD)) = arrV(UBound(arrV))
SubDividePolyline = Rhino.AddCurve(arrSubD)

End Function