Sub init
bg = "LightGray"
pc = "lightgreen"
If met Then
GraphicsWindow.Title = "Molecular Structure of Methane"
bb=LDShapes.BrushGradient("1=skyblue;2=darkblue" "DD")
Else
GraphicsWindow.Title = "Molecular Structure of CFC-11 (Chlorofluorocarbon)"
bb=LDShapes.BrushGradient("1=lightgray;2=#222222" "DD")
EndIf
ox = cx
oy = y2
FillCircle()
' draw Cl (2)
at = atom["Cl"]
ox = cx - distance * root3 / 2 * c
oy = cy + distance * s
FillCircle()
' draw line (2)
x1 = cx - d1 * root3 / 2 * c
y1 = cy + d1 * s
x2 = cx - d2 * root3 / 2 * c
y2 = cy + d2 * s
n = 1
DrawLine()
' draw Cl (3)
ox = cx + distance * root3 / 2 * c
FillCircle()
' draw line (3)
x1 = cx + d1 * root3 / 2 * c
y1 = cy + d1 * s
x2 = cx + d2 * root3 / 2 * c
y2 = cy + d2 * s
n = 1
DrawLine()
' draw C
at = atom["C"]
ox = cx
oy = cy
FillCircle()
' draw Cl (4)
at = atom["Cl"]
ox = cx
oy = cy + distance * s
FillCircle()
EndSub
Sub DrawLine
GraphicsWindow.PenColor = pc
If n = 2 Then
GraphicsWindow.PenWidth = 12
GraphicsWindow.DrawLine(x1, y1, x2, y2)
GraphicsWindow.PenColor = bg
EndIf
GraphicsWindow.PenWidth = 6
GraphicsWindow.DrawLine(x1, y1, x2, y2)
EndSub
Sub DrawMolecularName
GraphicsWindow.FontName = "Trebuchet MS"
GraphicsWindow.BrushColor = "Black"
x = 30
For p = 1 To Text.GetLength(mol)
c = Text.GetSubText(mol, p, 1)
If c = "_" Then
y = 35
p = p + 1
fs = 20
c = Text.GetSubText(mol, p, 1)
Else
y = 20
fs = 30
EndIf
GraphicsWindow.FontSize = fs
GraphicsWindow.DrawText(x, y, c)
x = x + fs * 0.7
EndFor
EndSub
Sub FillCircle
size=at["size"]
bc=at["color"]
c2=at["c2"]
GraphicsWindow.BrushColor = bc
bb=LDShapes.BrushGradient("1="+bc+";2="+c2 "")
LDShapes.BrushEllipse(bb ox - size / 2, oy - size / 2 size size)
If opt <> "" Then
GraphicsWindow.FontSize = 35
GraphicsWindow.BrushColor = pc
GraphicsWindow.DrawText(ox + size / 2, oy - size / 2, opt)
EndIf
EndSub