Ilias, Ján, Natalia, Stefana

Assignment 2
Student Names: Ilias, Ján, Natalia, Stefana

This slideshow requires JavaScript.

Assignment 2 PDF

when i figure out how, i’ll add the rhino file and grasshopper deffinitions too 🙂

jan

VB script:

Private Sub RunScript(ByVal uvpts As DataTree(Of Object), ByVal uvnrmls As DataTree(Of Object), ByRef walls As Object)
‘your code goes here…

Dim plns As New List (Of Plane)
Dim pts As New List (Of List (Of Point3d))
Dim nrms As New list (Of Vector3d)
Dim bott, tps, tps2 As New List (Of Point3d)
Dim srfs As New List (Of Surface)
Dim srfs2 As New List (Of Object)
Dim srfs3 As New List (Of Surface)
Dim stiffness As Double
Dim i,j As Integer
Dim toprow0, toprow1 As New List (Of Point3d)
Dim toppoints As New List (Of List (Of Point3d))

bott.Add(uvpts.branch(0)(0))
bott.Add(uvpts.branch(0)(1))
bott.Add(uvpts.branch(1)(1))
bott.Add(uvpts.branch(1)(0))

nrms.Add(uvnrmls.Branch(0)(0))
nrms.Add(uvnrmls.Branch(0)(1))
nrms.Add(uvnrmls.Branch(1)(1))
nrms.Add(uvnrmls.Branch(1)(0))

stiffness = four_walls(bott, nrms, tps, srfs)
While stiffness = 0
Dim v As New Vector3d (bott(3) – bott(0))
v = v * 0.1
nrms(0) = nrms(0) + v
v
= New Vector3d (bott(1) – bott(2))
v = v * 0.1
nrms(2) = nrms(2) + v
stiffness = four_walls(bott, nrms, tps, srfs)
End While
For Each face As Surface In srfs
srfs2.Add(face)
Next

toprow0.Add(tps(0))
toprow0.Add(tps(1))
toprow1.Add(tps(3))
toprow1.Add(tps(2))

For i = 1 To uvpts.branch(0).Count – 2

bott(0) = uvpts.branch(0)(0 + i)
bott(1) = uvpts.branch(0)(1 + i)
bott(2) = uvpts.branch(1)(1 + i)
bott(3) = uvpts.branch(1)(0 + i)

nrms(0) = uvnrmls.Branch(0)(0 + i)
nrms(1) = uvnrmls.Branch(0)(1 + i)
nrms(2) = uvnrmls.Branch(1)(1 + i)
nrms(3) = uvnrmls.Branch(1)(0 + i)

tps(0) = tps(1)
tps(3) = tps(2)
tps(1) = New Point3d(0, 0, 0)
tps(2) = New Point3d(0, 0, 0)

srfs.Clear

stiffness = three_walls(bott, nrms, tps, srfs)
While stiffness = 0
Dim v As New Vector3d (bott(1) – bott(2))
v = v * 0.1
nrms(2) = nrms(2) + v
stiffness = four_walls(bott, nrms, tps, srfs)
End While

For Each face As Surface In srfs
srfs2.Add(face)
Next

toprow0.Add(tps(1))
toprow1.Add(tps(2))

Next

toppoints.Add(toprow0)
toppoints.Add(toprow1)

tps(1) = toprow1(1)
tps(2) = toprow1(0)

For i = 1 To uvpts.BranchCount – 2

toprow0.Clear
toprow0.AddRange(toprow1)
toprow1.clear

bott(0) = uvpts.branch(0 + i)(1)
bott(1) = uvpts.branch(1 + i)(1)
bott(2) = uvpts.branch(1 + i)(0)
bott(3) = uvpts.branch(0 + i)(0)

nrms(0) = uvnrmls.Branch(0 + i)(1)
nrms(1) = uvnrmls.Branch(1 + i)(1)
nrms(2) = uvnrmls.Branch(1 + i)(0)
nrms(3) = uvnrmls.Branch(0 + i)(0)

tps(0) = toprow0(1)
tps(3) = toprow0(0)
tps(1) = New Point3d(0, 0, 0)
tps(2) = New Point3d(0, 0, 0)

srfs.Clear

stiffness = three_walls(bott, nrms, tps, srfs)
While stiffness = 0
Dim v As New Vector3d (bott(1) – bott(2))
v = v * 0.1
nrms(2) = nrms(2) + v
stiffness = four_walls(bott, nrms, tps, srfs)
End While

For Each face As Surface In srfs
srfs2.Add(face)
Next

toprow1.add(tps(2))
toprow1.add(tps(1))

tps(3) = tps(1)
tps(1) = toprow0(1 + 1)
tps(2) = New Point3d(0, 0, 0)

For j = 1 To uvpts.branch(0).Count – 2
”For j = 1 To 1
bott(0) = uvpts.branch(0 + i)(0 + j)
bott(1) = uvpts.branch(0 + i)(1 + j)
bott(2) = uvpts.branch(1 + i)(1 + j)
bott(3) = uvpts.branch(1 + i)(0 + j)

srfs.Clear

stiffness = two_walls(bott, tps, srfs)
For Each face As Surface In srfs
srfs2.Add(face)
Next
toprow1.add(tps(2))
If j = pts(0).Count Then j = 0
srf = nurbssurface.CreateFromCorners(pts(0)(i), pts(1)(i), pts(1)(j), pts(0)(j))
surfs.add(srf)
Next
walls = surfs

Dim stiff As Double = 0
Dim plnA, plnB As Plane
Dim nA, nB As Vector3d
plnA = New plane (pts(0)(0), pts(0)(2), pts(1)(0))
nA = plnA.Normal
nA.Unitize
plnB = New plane (pts(0)(0), pts(0)(2), pts(1)(2))
nB = plnB.Normal
nB.Unitize

Dim bodA As New point3d(0, 0, 0)
bodA = bodA + nA
Dim bodB As New point3d(0, 0, 0)
bodB = bodB + nB
stiff = bodB.DistanceTo(bodA)
If stiff <= RhinoMath.ZeroTolerance Then
stiff = 0
End If
print("stiffness coefficient A: " & stiff.ToString)

plnA = New plane (pts(0)(3), pts(0)(1), pts(1)(3))
nA = plnA.Normal
nA.Unitize
plnB = New plane (pts(0)(3), pts(0)(1), pts(1)(1))
nB = plnB.Normal
nB.Unitize
bodA = New point3d(0, 0, 0)
bodA = bodA + nA
bodB = New point3d(0, 0, 0)
bodB = bodB + nB
Dim dist2 As Double = bodB.DistanceTo(bodA)
If dist2 = pts(0).Count Then j = 0
srf = nurbssurface.CreateFromCorners(pts(0)(i), pts(1)(i), pts(1)(j), pts(0)(j))
surfs.add(srf)
Next
walls = surfs

Dim stiff As Double = 0
Dim plnA, plnB As Plane
Dim nA, nB As Vector3d
plnA = New plane (pts(0)(0), pts(0)(2), pts(1)(0))
nA = plnA.Normal
nA.Unitize
plnB = New plane (pts(0)(0), pts(0)(2), pts(1)(2))
nB = plnB.Normal
nB.Unitize

Dim bodA As New point3d(0, 0, 0)
bodA = bodA + nA
Dim bodB As New point3d(0, 0, 0)
bodB = bodB + nB
stiff = bodB.DistanceTo(bodA)
If stiff <= RhinoMath.ZeroTolerance Then
stiff = 0
End If
print("stiffness coefficient A: " & stiff.ToString)

plnA = New plane (pts(0)(3), pts(0)(1), pts(1)(3))
nA = plnA.Normal
nA.Unitize
plnB = New plane (pts(0)(3), pts(0)(1), pts(1)(1))
nB = plnB.Normal
nB.Unitize
bodA = New point3d(0, 0, 0)
bodA = bodA + nA
bodB = New point3d(0, 0, 0)
bodB = bodB + nB
Dim dist2 As Double = bodB.DistanceTo(bodA)
If dist2 = pts(0).Count Then j = 0
srf = nurbssurface.CreateFromCorners(pts(0)(i), pts(1)(i), pts(1)(j), pts(0)(j))
surfs.add(srf)
Next
walls = surfs

Dim stiff As Double = 0
Dim plnA, plnB As Plane
Dim nA, nB As Vector3d
plnA = New plane (pts(0)(0), pts(0)(2), pts(1)(0))
nA = plnA.Normal
nA.Unitize
plnB = New plane (pts(0)(0), pts(0)(2), pts(1)(2))
nB = plnB.Normal
nB.Unitize

Dim bodA As New point3d(0, 0, 0)
bodA = bodA + nA
Dim bodB As New point3d(0, 0, 0)
bodB = bodB + nB
stiff = bodB.DistanceTo(bodA)
If stiff <= RhinoMath.ZeroTolerance Then
stiff = 0
End If
print("stiffness coefficient A: " & stiff.ToString)

plnA = New plane (pts(0)(3), pts(0)(1), pts(1)(3))
nA = plnA.Normal
nA.Unitize
plnB = New plane (pts(0)(3), pts(0)(1), pts(1)(1))
nB = plnB.Normal
nB.Unitize
bodA = New point3d(0, 0, 0)
bodA = bodA + nA
bodB = New point3d(0, 0, 0)
bodB = bodB + nB
Dim dist2 As Double = bodB.DistanceTo(bodA)
If dist2 <= RhinoMath.ZeroTolerance Then
dist2 = 0
End If
stiff = stiff * dist2
print("stiffness coefficient B: " & dist2.ToString)
print("Stiffness factor of the unit: " & stiff.ToString)

Return stiff
End Function

One thought on “Ilias, Ján, Natalia, Stefana

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s