the Platonic Solids

screenshot_2-17-2016_5

There are 5 and only 5 solids that are made with every side the same figure. The Greeks were fascinated by these solids. Plato tried to explain all of creation with them (fire is like the tetrahedron, etc).

https://en.wikipedia.org/wiki/Platonic_solid
http://www.vb-helper.com/tutorial_platonic_solids.html

first lets make a helper sub to initialize 3D points.

Sub initpt(ByRef ptn() As Double, val1, val2, val3)
ptn(0) = val1: ptn(1) = val2: ptn(2) = val3
End Sub

screenshot_3-1-2016_2
The tetrahedron has 4 points called vertices and 4 faces. An easy way to draw it is with one point in each of the 4 quadrants, points opposite each other across the origin are at the same Z coordinate.

screenshot_2-17-2016_6

screenshot_2-17-2016_7


Sub tetrahedron2()
Call connect_acad

Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
Dim pt3(0 To 2) As Double
Dim pt4(0 To 2) As Double

Call initpt(pt1, 1, 1, 1)
Call initpt(pt2, -1, 1, -1)
Call initpt(pt3, -1, -1, 1)
Call initpt(pt4, 1, -1, -1)

'Call point(pt1, "pt1")
'Call point(pt2, "pt2")
'Call point(pt3, "pt3")
'Call point(pt4, "pt4")

'creates 3DFace
Dim objent As Acad3DFace
Set objent = acadDoc.ModelSpace.Add3DFace(pt1, pt3, pt2, pt2)
Set objent = acadDoc.ModelSpace.Add3DFace(pt1, pt3, pt4, pt4)
Set objent = acadDoc.ModelSpace.Add3DFace(pt2, pt4, pt1, pt1)
Set objent = acadDoc.ModelSpace.Add3DFace(pt2, pt4, pt3, pt3)

objent.Update
End Sub

switching the sign on the Z elevations will produce the rotated version, drawn here in a one unit square transparent box, which is also a Platonic solid. the 8 points for the box are organized by quadrants.

screenshot_2-17-2016_2

Sub box1()
Call connect_acad
Dim intviz As Integer
intviz = 67

Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
Dim pt3(0 To 2) As Double
Dim pt4(0 To 2) As Double

Dim pt5(0 To 2) As Double
Dim pt6(0 To 2) As Double
Dim pt7(0 To 2) As Double
Dim pt8(0 To 2) As Double

Call initpt(pt1, 1, 1, 1)
Call initpt(pt2, -1, 1, 1)
Call initpt(pt3, -1, -1, 1)
Call initpt(pt4, 1, -1, 1)

Call initpt(pt5, 1, 1, -1)
Call initpt(pt6, -1, 1, -1)
Call initpt(pt7, -1, -1, -1)
Call initpt(pt8, 1, -1, -1)

'creates 3DFace
Dim objent As Acad3DFace
Set objent = acadDoc.ModelSpace.Add3DFace(pt1, pt4, pt8, pt5)
objent.EntityTransparency = intviz

Set objent = acadDoc.ModelSpace.Add3DFace(pt1, pt2, pt6, pt5)
objent.EntityTransparency = intviz

Set objent = acadDoc.ModelSpace.Add3DFace(pt2, pt3, pt7, pt6)
objent.EntityTransparency = intviz

Set objent = acadDoc.ModelSpace.Add3DFace(pt3, pt4, pt8, pt7)
objent.EntityTransparency = intviz

Set objent = acadDoc.ModelSpace.Add3DFace(pt1, pt2, pt3, pt4)
objent.EntityTransparency = intviz

Set objent = acadDoc.ModelSpace.Add3DFace(pt5, pt6, pt7, pt8)
objent.EntityTransparency = intviz

objent.Update
End Sub

the octahedron has 6 vertices and 8 faces.

screenshot_2-17-2016_8

screenshot_2-17-2016_9

Sub octahedron()
Call connect_acad
Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
Dim pt3(0 To 2) As Double
Dim pt4(0 To 2) As Double
Dim pt5(0 To 2) As Double
Dim pt6(0 To 2) As Double

Call initpt(pt1, 1, 0, 0)
Call initpt(pt2, 0, 1, 0)
Call initpt(pt3, -1, 0, 0)
Call initpt(pt4, 0, -1, 0)
Call initpt(pt5, 0, 0, 1)
Call initpt(pt6, 0, 0, -1)

'Call point(pt1, "pt1")
'Call point(pt2, "pt2")
'Call point(pt3, "pt3")
'Call point(pt4, "pt4")
'Call point(pt5, "pt5")
'Call point(pt6, "pt6")

'creates 3DFace
Dim objent As Acad3DFace
'top half
Set objent = acadDoc.ModelSpace.Add3DFace(pt1, pt2, pt5, pt5)
Set objent = acadDoc.ModelSpace.Add3DFace(pt2, pt3, pt5, pt5)
Set objent = acadDoc.ModelSpace.Add3DFace(pt3, pt4, pt5, pt5)
Set objent = acadDoc.ModelSpace.Add3DFace(pt4, pt1, pt5, pt5)

'bottom half
Set objent = acadDoc.ModelSpace.Add3DFace(pt1, pt2, pt6, pt6)
Set objent = acadDoc.ModelSpace.Add3DFace(pt2, pt3, pt6, pt6)
Set objent = acadDoc.ModelSpace.Add3DFace(pt3, pt4, pt6, pt6)
Set objent = acadDoc.ModelSpace.Add3DFace(pt4, pt1, pt6, pt6)

objent.Update
End Sub

screenshot_2-17-2016_3

Advertisements

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