Johannes Itten – “Tower of Fire”,parametric model
October 21st, 2009 by SebastianHaving seen a rebuilt of Itten’s “Tower of Fire” at the Bauhaus exhibition, I started swcripting a parametric model of the tower in the spirit of the workshop we’re planning to do next year. The VBA script runs in Microstation and is modified by the following parameters:
- cSize As Double = edgeLength of the bottom cube
- cAngle As Double = rotation in plan between each cube
- cNumber As Long = number of cubes / levels
- cScale As Double = the bottom radii of the cones equals the diagnal conrner distance by default. This is scaled by cScale parameter
- uSeg As Long = Number of linear panels on cone
- vSeg As Long = Number of circular panels on cone
- cRad As Double = Radius of panel frames
Images of rebuilts of the tower:
‘Draw a “tower of fire”
‘Parametric approach to Johannes Itten’s design
‘Sebastian Gmelin
’19.10.2009
Option Explicit
Const cSize As Double = 60
Const cAngle As Double = 3
Const cNumber As Long = 40
Const cScale As Double = 2
Const uSeg As Long = 10
Const vSeg As Long = 1
Const cRad As Double = 0.05
Public Type cube
height As Double
startPoint As Point3d
endPoint As Point3d
direction As Point3d
botVertex(5) As Point3d
topVertex(5) As Point3d
End Type
Dim cubes() As cube
Sub Main()
Dim i As Long
Dim k As Long
Dim p As Long
Dim q As Long
Dim size As Double
Dim direction As Point3d
Dim startPoint As Point3d
Dim endPoint As Point3d
Dim height As Double
Dim cOffset As Double
Dim conePoints(4) As Point3d
Dim cSpans() As Point2d
Dim cSurface As New BsplineSurface
Dim cCurves(2) As New BsplineCurve
Dim isoCurves() As New BsplineCurve
Dim cPath As New BsplineCurve
Dim line As Element
Dim coneEdge(2) As Element
Dim cLine(3) As Element
Dim cArc As Element
Dim cSurfElement As BsplineSurfaceElement
Dim cSpline As BsplineCurveElement
ReDim cubes(cNumber)
size = cSize
direction = Point3dFromXYZ(1, 0, 0)
startPoint = Point3dFromXYZ(size / -2, size / 2, 0)
endPoint = Point3dFromXYZ(size / 2, size / 2, 0)
height = Point3dDistance(endPoint, startPoint)
For i = 1 To cNumber
Call createBox(startPoint, endPoint)
cOffset = Atn(cAngle * 3.141 / 180) * height
height = Point3dDistance(endPoint, startPoint)
‘store data
cubes(i).height = height
cubes(i).startPoint = startPoint
cubes(i).endPoint = endPoint
cubes(i).direction = direction
cubes(i).botVertex(1) = startPoint
cubes(i).botVertex(2) = endPoint
cubes(i).botVertex(3) = Point3dSubtract(endPoint, Point3dCrossProduct(Point3dSubtract(endPoint, startPoint), Point3dFromXYZ(0, 0, 1)))
cubes(i).botVertex(4) = Point3dSubtract(startPoint, Point3dCrossProduct(Point3dSubtract(endPoint, startPoint), Point3dFromXYZ(0, 0, 1)))
cubes(i).botVertex(0) = cubes(i).botVertex(4)
cubes(i).botVertex(5) = cubes(i).botVertex(1)
For k = 0 To 5
cubes(i).topVertex(k) = cubes(i).botVertex(k)
cubes(i).topVertex(k).z = cubes(i).botVertex(k).z + height
Next
‘draw testpoints
CadInputQueue.SendCommand “ACTIVE STYLE 1″
Set line = CreateLineElement2(Nothing, cubes(i).botVertex(1), cubes(i).topVertex(3))
ActiveModelReference.AddElement line
line.Redraw
Set line = CreateLineElement2(Nothing, cubes(i).botVertex(2), cubes(i).topVertex(4))
ActiveModelReference.AddElement line
line.Redraw
Set line = CreateLineElement2(Nothing, cubes(i).botVertex(3), cubes(i).topVertex(1))
ActiveModelReference.AddElement line
line.Redraw
Set line = CreateLineElement2(Nothing, cubes(i).botVertex(4), cubes(i).topVertex(2))
ActiveModelReference.AddElement line
line.Redraw
‘change data for next cube
startPoint = Point3dSubtract(startPoint, Point3dScale(Point3dNormalize(Point3dCrossProduct(direction, Point3dFromXYZ(0, 0, 1))), cOffset))
endPoint = Point3dSubtract(endPoint, Point3dScale(Point3dNormalize(direction), cOffset))
direction = Point3dSubtract(endPoint, startPoint)
startPoint.z = startPoint.z + height
endPoint.z = endPoint.z + height
Next
For i = 2 To cNumber
For k = 1 To 4
SetCExpressionValue “tcb->symbology.color”, 0, “MGDSHOOK”
CadInputQueue.SendCommand “ACTIVE STYLE 2″
conePoints(0) = cubes(i).topVertex(k)
conePoints(1) = cubes(i – 1).topVertex(k)
conePoints(2) = cubes(i).topVertex(k + 1)
conePoints(3) = Point3dScale(Point3dAdd(conePoints(1), conePoints(2)), 0.5)
conePoints(4) = Point3dAdd(conePoints(3), Point3dScale(Point3dNormalize(Point3dCrossProduct(Point3dSubtract(conePoints(3), conePoints(0)), Point3dSubtract(conePoints(2), conePoints(1)))), cubes(i).height * cScale))
Set coneEdge(1) = CreateLineElement2(Nothing, cubes(i – 1).topVertex(k), cubes(i).topVertex(k))
ActiveModelReference.AddElement coneEdge(1)
coneEdge(1).Redraw
Set coneEdge(2) = CreateLineElement2(Nothing, cubes(i).topVertex(k), cubes(i).topVertex(k + 1))
ActiveModelReference.AddElement coneEdge(2)
coneEdge(2).Redraw
Set cLine(1) = CreateLineElement2(Nothing, conePoints(1), conePoints(2))
ActiveModelReference.AddElement cLine(1)
cLine(1).Redraw
Set cLine(1) = CreateLineElement2(Nothing, conePoints(0), conePoints(3))
ActiveModelReference.AddElement cLine(1)
cLine(1).Redraw
Set cLine(1) = CreateLineElement2(Nothing, conePoints(3), conePoints(4))
ActiveModelReference.AddElement cLine(1)
cLine(1).Redraw
Set cArc = CreateArcElement3(Nothing, conePoints(1), conePoints(4), conePoints(2))
ActiveModelReference.AddElement cArc
cArc.Redraw
Call cCurves(0).FromElement(coneEdge(1))
Call cCurves(1).FromElement(coneEdge(2))
Call cCurves(2).FromElement(cArc)
SetCExpressionValue “tcb->symbology.color”, k, “MGDSHOOK”
CadInputQueue.SendCommand “ACTIVE STYLE 0″
Call cSurface.FromRailsAndSweptSections(cCurves(0), cCurves(1), cCurves(2), Nothing)
Set cSurfElement = CreateBsplineSurfaceElement1(Nothing, cSurface)
ActiveModelReference.AddElement cSurfElement
cSurfElement.Redraw
‘create Network U
For q = 0 To uSeg
isoCurves = cSurface.ExtractIsoparametricCurve(cSpans, q / uSeg, msdBsplineSurfaceU)
For p = LBound(isoCurves) To UBound(isoCurves)
Set cSpline = CreateBsplineCurveElement1(Nothing, isoCurves(p))
ActiveModelReference.AddElement cSpline
cSpline.Redraw
Call createTube(cRad, isoCurves(p))
Next p
Next q
‘create Network V
For q = 0 To vSeg
isoCurves = cSurface.ExtractIsoparametricCurve(cSpans, q / vSeg, msdBsplineSurfaceV)
For p = LBound(isoCurves) To UBound(isoCurves)
Set cSpline = CreateBsplineCurveElement1(Nothing, isoCurves(p))
ActiveModelReference.AddElement cSpline
cSpline.Redraw
Call createTube(cRad, isoCurves(p))
Next p
Next q
Next k
Next i
End Sub
Sub createBox(startPoint As Point3d, endPoint As Point3d)
CadInputQueue.SendCommand “ACTIVE STYLE 0″
SetCExpressionValue “tcb->symbology.color”, 0, “MGDSHOOK”
‘ Start a command
CadInputQueue.SendCommand “MODELER BLOCK”
‘ Set a variable associated with a dialog box
SetCExpressionValue “tcb->ms3DToolSettings.block.axisMode”, 0, “FEATURESOLID”
SetCExpressionValue “tcb->ms3DToolSettings.block.length.value”, (ActiveModelReference.UORsPerMasterUnit * Abs(Point3dDistance(startPoint, endPoint))), “FEATURESOLID”
SetCExpressionValue “tcb->ms3DToolSettings.block.width.value”, (ActiveModelReference.UORsPerMasterUnit * Abs(Point3dDistance(startPoint, endPoint))), “FEATURESOLID”
SetCExpressionValue “tcb->ms3DToolSettings.block.height.value”, (ActiveModelReference.UORsPerMasterUnit * Abs(Point3dDistance(startPoint, endPoint))), “FEATURESOLID”
SetCExpressionValue “tcb->ms3DToolSettings.block.height.locked”, 0, “FEATURESOLID”
SetCExpressionValue “tcb->ms3DToolSettings.block.width.locked”, 0, “FEATURESOLID”
SetCExpressionValue “tcb->ms3DToolSettings.block.length.locked”, 0, “FEATURESOLID”
CadInputQueue.SendDataPoint startPoint, 1
‘ Send a keyin that can be a command string
CadInputQueue.SendKeyin “AccuDraw Rotate Top”
CadInputQueue.SendDataPoint endPoint, 1
CadInputQueue.SendDataPoint Point3dSubtract(startPoint, Point3dCrossProduct(Point3dSubtract(endPoint, startPoint), Point3dFromXYZ(0, 0, 1))), 1
CadInputQueue.SendDataPoint Point3dAdd(startPoint, Point3dFromXYZ(0, 0, Abs(Point3dDistance(startPoint, endPoint)))), 1
CadInputQueue.SendCommand “CHOOSE ELEMENT”
CommandState.StartDefaultCommand
End Sub
Sub createTube(rad As Double, path As BsplineCurve)
Dim Frame As Matrix3d
Dim Curvature As Double
Dim Torsion As Double
Dim Parameter As Double
Dim LinearNormal As Point3d
Dim Normal As Point3d
Dim cPoint As Point3d
Dim circ As Element
Dim Rot As Matrix3d
Dim line As Element
Dim x As Point3d
Dim y As Point3d
Dim z As Point3d
Dim startPoint As Point3d
Dim endPoint As Point3d
Dim cSurface As New BsplineSurface
Dim cSurfElement As BsplineSurfaceElement
Dim cSection As New BsplineCurve
endPoint = path.EvaluatePointFrame(Frame, Curvature, Torsion, 1, LinearNormal)
startPoint = path.EvaluatePointFrame(Frame, Curvature, Torsion, 0, LinearNormal)
cPoint = startPoint
y = Point3dNormalize(Point3dCrossProduct(Frame.RowY, Frame.RowX))
z = Point3dNormalize(Frame.RowX)
x = Point3dNormalize(Point3dCrossProduct(y, z))
Rot = Matrix3dFromPoint3dColumns(x, y, z)
Set line = CreateLineElement2(Nothing, cPoint, Point3dAdd(cPoint, x))
line.Color = 1
ActiveModelReference.AddElement line
line.Redraw
Set line = CreateLineElement2(Nothing, cPoint, Point3dAdd(cPoint, y))
line.Color = 2
ActiveModelReference.AddElement line
line.Redraw
Set line = CreateLineElement2(Nothing, cPoint, Point3dAdd(cPoint, z))
line.Color = 3
ActiveModelReference.AddElement line
line.Redraw
Set circ = CreateEllipseElement2(Nothing, cPoint, rad, rad, Rot)
ActiveModelReference.AddElement circ
circ.Redraw
Call cSection.FromElement(circ)
SetCExpressionValue “tcb->symbology.color”, 6, “MGDSHOOK”
CadInputQueue.SendCommand “ACTIVE STYLE 0″
Call cSurface.FromRailAndSweptSection(path, cSection)
Set cSurfElement = CreateBsplineSurfaceElement1(Nothing, cSurface)
ActiveModelReference.AddElement cSurfElement
cSurfElement.Redraw
End Sub


















