Process+Emergence-Scripting-MICROSTATION_VBA-Boxes_Lines_Points
Boxes_In_Spiral

mvba script code (left)
Sub boxspiral03()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim boxlength As Double
Dim boxwith As Double
Dim boxheight As Double
Dim turn As Integer
Dim angle As Double
Dim vertstep As Double
Dim length_xdist As Double
Dim length_ydist As Double
Dim width_xdist As Double
Dim width_ydist As Double
Dim zdist As Double
boxlength = 0.2
boxwith = 0.1
boxheight = 0.1
verstep = 0.05
angle = 0
zdist = 0
‘ Coordinates are in master units
startPoint.X = 0#
startPoint.Y = 0#
startPoint.Z = 0#
For turn = 1 To 100
length_xdist = boxlength * Cos(angle)
length_ydist = boxlength * Sin(angle)
width_xdist = boxwidth * Cos((Pi / 2) + angle)
width_ydist = boxwidth * Sin((Pi / 2) – angle)
zdist = zdist + 0.0
‘ start a command
CadInputQueue.SendCommand “PLACE SLAB ICON”
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + length_xdist
point.Y = startPoint.Y + length_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + width_xdist
point.Y = startPoint.Y + width_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z + boxheight
CadInputQueue.SendDataPoint point, 3
CommandState.StartDefaultCommand
angle = angle + (Pi / 24)
startPoint.Z = startPoint.Z + verstep
boxlength = boxlength – 0.01
boxwidth = boxwidth – 0.1
zdist = zdist + 0.01
Next
End Sub
mvba script code (right)
Sub boxspiral05()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim boxlength As Double
Dim boxwith As Double
Dim boxheight As Double
Dim turn As Integer
Dim angle As Double
Dim length_xdist As Double
Dim length_ydist As Double
Dim width_xdist As Double
Dim width_ydist As Double
Dim zdist As Double
boxlength = 0.2
boxwith = 0.1
boxheight = 0.1
angle = 0
zdist = 0
‘ Coordinates are in master units
startPoint.X = 0#
startPoint.Y = 0#
startPoint.Z = 0#
For turn = 1 To 100
length_xdist = boxlength * Cos(angle)
length_ydist = boxlength * Sin(angle)
width_xdist = boxwidth * Cos((Pi / 2) + angle)
width_ydist = boxwidth * Sin((Pi / 2) – angle)
‘ start a command
CadInputQueue.SendCommand “PLACE SLAB ICON”
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + length_xdist
point.Y = startPoint.Y + length_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + width_xdist
point.Y = startPoint.Y + width_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z + boxheight
CadInputQueue.SendDataPoint point, 3
CommandState.StartDefaultCommand
angle = angle + (Pi / 24)
startPoint.Z = startPoint.Z + zdist
boxlength = boxlength – 0.01
boxwidth = boxwidth – 0.1
zdist = zdist + 0.01
Next
End Sub

mvba script code
Sub boxspiral08()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim verstep As Double
Dim boxlength As Double
Dim boxwith As Double
Dim boxheight As Double
Dim turn As Integer
Dim angle As Double
Dim divisor As Integer
Dim radius As Double
Dim length_xdist As Double
Dim length_ydist As Double
Dim width_xdist As Double
Dim width_ydist As Double
Dim zdist As Double
boxlength = 0.2
boxwith = 0.1
boxheight = 0.1
angle = (Pi / 2)
zdist = 0
divisor = 0
radius = 0.015
‘ Coordinates are in master units
startPoint.X = 0#
startPoint.Y = 0#
startPoint.Z = 0#
For turn = 1 To 100
length_xdist = boxlength * (Cos(angle) / 2 + angle)
length_ydist = boxlength * (Sin(angle) / 2) – angle
width_xdist = boxwidth * Cos((Pi / 2) – angle)
width_ydist = boxwidth * Sin((Pi / 2) – angle)
‘ start a command
CadInputQueue.SendCommand “PLACE SLAB ICON”
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + length_xdist
point.Y = startPoint.Y + length_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + width_xdist
point.Y = startPoint.Y + width_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z + boxheight
CadInputQueue.SendDataPoint point, 3
CommandState.StartDefaultCommand
angle = angle + (Pi / 24)
startPoint.Z = startPoint.Z + zdist
boxlength = boxlength – 0.01
boxwidth = boxwidth – 0.1
zdist = 0.05
radius = 0.015
verstep = 0.05
Next
End Sub

mvba script code (left)
Sub boxspiral09()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim verstep As Double
Dim boxlength As Double
Dim boxwith As Double
Dim boxheight As Double
Dim turn As Integer
Dim angle As Double
Dim divisor As Integer
Dim radius As Double
Dim length_xdist As Double
Dim length_ydist As Double
Dim width_xdist As Double
Dim width_ydist As Double
Dim zdist As Double
boxlength = 0.2
boxwith = 0.1
boxheight = 0.1
angle = (Pi / 2)
zdist = 0
divisor = 0
radius = 0.015
‘ Coordinates are in master units
startPoint.X = 0#
startPoint.Y = 0#
startPoint.Z = 0#
For turn = 1 To 100
length_xdist = boxlength * (Cos(angle) / 2 + angle)
length_ydist = boxlength * (Sin(angle) / 2) – angle
width_xdist = boxwidth * Cos((Pi / 2) + angle)
width_ydist = boxwidth * Sin((Pi / 2) – angle)
‘ start a command
CadInputQueue.SendCommand “PLACE SLAB ICON”
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + length_xdist
point.Y = startPoint.Y – length_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + width_xdist
point.Y = startPoint.Y – width_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z + boxheight
CadInputQueue.SendDataPoint point, 3
CommandState.StartDefaultCommand
angle = angle
startPoint.Z = startPoint.Z + zdist
boxlength = boxlength + 0.01
boxwidth = boxwidth + 0.1
zdist = 0.05
radius = 0.015
verstep = 0.05
Next
End Sub
mvba script code (right)
Sub boxspiral011()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim boxlength As Double
Dim boxwith As Double
Dim boxheight As Double
Dim turn As Integer
Dim angle As Double
Dim vertstep As Double
Dim length_xdist As Double
Dim length_ydist As Double
Dim width_xdist As Double
Dim width_ydist As Double
Dim zdist As Double
Dim radius As Double
Dim line As Double
boxlength = 0.2
boxwith = 0.1
boxheight = 0.15
verstep = 0.05
angle = 0
zdist = 0
radius = 0.15
‘ Coordinates are in master units
startPoint.X = 0#
startPoint.Y = 0#
startPoint.Z = 0#
For turn = 1 To 100
length_xdist = boxlength * Cos(angle)
length_ydist = boxlength * Sin(angle)
width_xdist = boxwidth * Cos((Pi / 2) + angle)
width_ydist = boxwidth * Sin((Pi / 2) – angle)
radius = 0.15
zdist = zdist + 0.01
‘ start a command
CadInputQueue.SendCommand “PLACE SLAB ICON”
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + length_xdist + line
point.Y = startPoint.Y + length_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + width_xdist
point.Y = startPoint.Y + width_ydist
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z + boxheight
CadInputQueue.SendDataPoint point, 3
CommandState.StartDefaultCommand’ Start a command
CadInputQueue.SendCommand “DMSG ACTIVATETOOLBYPATH
DrawingLinearPlace
SmartLine”
CadInputQueue.SendCommand “PLACE SMARTLINE”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0#
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = startPoint.X + length_xdist
point.Y = startPoint.Y + length_ydist
point.Z = startPoint.Z + boxheight + zdist
CadInputQueue.SendDataPoint point, 1
‘ Send a reset to the current command
CadInputQueue.SendReset
angle = angle + (Pi / 24)
startPoint.Z = (startPoint.Z + verstep)
boxlength = (boxlength + 0.01)
boxwidth = (boxwidth + 0.1) * (Pi / 6)
zdist = (zdist + 0.01)
radius = 0.15
line = (startPoint.Z + verstep)
Next
End Sub
Points_In_Spiral_Lines

mvba script code (left)
Sub spiral8()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim radius As Double
Dim angle As Double
Dim xdist As Double
Dim ydist As Double
Dim npoints As Integer
Dim zdist As Double
Dim divisor As Integer
Dim turn As Integer
Dim maxpoints As Integer
angle = o
radius = 1
maxpoints = 100
zdist = 0
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 4″
For npoints = 1 To 300
angle = angle + (Pi / 48)
xdist = (radius – 0.015) * Cos(2 * angle)
ydist = radius * Sin(2 * angle)
zdist = zdist + Sin(2 * angle)
CadInputQueue.SendCommand “PLACE POINT”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 2
point.X = (startPoint.X + xdist) * angle
point.Y = (startPoint.Y + ydist)
point.Z = (startPoint.Z + zdist)
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
Next
End Sub
mvba script code (right)
Sub spiral9()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim radius As Double
Dim angle As Double
Dim xdist As Double
Dim ydist As Double
Dim npoints As Integer
Dim zdist As Double
Dim divisor As Integer
Dim turn As Integer
Dim maxpoints As Integer
angle = o
radius = 1
maxpoints = 100
zdist = 0
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 3″
For npoints = 1 To 200
angle = angle + (Pi / 48)
xdist = xdist + Cos(2 * angle)
ydist = ydist + (radius * Sin(2 * angle))
zdist = Sin(2 * angle)
CadInputQueue.SendCommand “PLACE POINT”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 2
point.X = (startPoint.X + xdist) * Cos(angle / 2)
point.Y = (startPoint.Y + ydist) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist) * angle / 2
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
Next
End Sub

mvba script code
Sub spiral16()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim radius As Double
Dim angle As Double
Dim xdist As Double
Dim ydist As Double
Dim npoints As Integer
Dim zdist As Double
Dim divisor As Integer
Dim turn As Integer
Dim maxpoints As Integer
angle = o
radius = 1
maxpoints = 100
zdist = 0
For npoints = 1 To 200
angle = angle + (Pi / 48)
xdist = xdist + Cos(2 * angle)
ydist = ydist + (radius * Sin(2 * angle))
zdist = Sin(2 * angle)
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 1″
CadInputQueue.SendCommand “DMSG ACTIVATETOOLBYPATH
DrawingLinearPlace SmartLine”
CadInputQueue.SendCommand “PLACE SMARTLINE”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = (startPoint.X + xdist + 0.15) * Cos(angle / 2)
point.Y = (startPoint.Y + ydist + 0.15) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist + 0.15) * Cos(angle / 2)
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 4″
CadInputQueue.SendCommand “PLACE POINT”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 2
point.X = (startPoint.X + xdist + 0.15) * Cos(angle / 2)
point.Y = (startPoint.Y + ydist + 0.15) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist + 0.15) * Cos(angle / 2)
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 1″
CadInputQueue.SendCommand “DMSG ACTIVATETOOLBYPATH
DrawingLinearPlace SmartLine”
CadInputQueue.SendCommand “PLACE SMARTLINE”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0′ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = (startPoint.X + xdist) * Cos(angle / 2)
point.Y = (startPoint.Y + ydist) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist + 0.5) * Cos(angle / 2)
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 4″
CadInputQueue.SendCommand “PLACE POINT”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 2
point.X = (startPoint.X + xdist) * Cos(angle / 2)
point.Y = (startPoint.Y + ydist) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist + 0.5) * Cos(angle / 2)
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 1″
CadInputQueue.SendCommand “DMSG ACTIVATETOOLBYPATH
DrawingLinearPlace SmartLine”
CadInputQueue.SendCommand “PLACE SMARTLINE”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = (startPoint.X + xdist) * Cos(angle / 2)
point.Y = (startPoint.Y – ydist) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist) * Cos(angle / 2)
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 4″
CadInputQueue.SendCommand “PLACE POINT”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 2
point.X = (startPoint.X + xdist) * Cos(angle / 2)
point.Y = (startPoint.Y – ydist) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist) * Cos(angle / 2)
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
Next
End Sub

mvba script code
Sub spiral17()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim radius As Double
Dim angle As Double
Dim xdist As Double
Dim ydist As Double
Dim npoints As Integer
Dim zdist As Double
Dim divisor As Integer
Dim turn As Integer
Dim maxpoints As Integer
angle = o
radius = 1
maxpoints = 100
zdist = 0
For npoints = 1 To 200
angle = angle + (Pi / 48)
xdist = xdist + Cos(2 * angle)
ydist = ydist + Sin(2 * angle)
zdist = zdist + Sin(2 * angle)
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 1″
CadInputQueue.SendCommand “DMSG ACTIVATETOOLBYPATH
DrawingLinearPlace SmartLine”
CadInputQueue.SendCommand “PLACE SMARTLINE
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1
point.X = (startPoint.X + xdist) + Cos(angle / 2)
point.Y = (startPoint.Y + ydist) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist) * angle / 2
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
‘ Start a command
CadInputQueue.SendCommand “ACTIVE WEIGHT 4″
CadInputQueue.SendCommand “PLACE POINT”
‘ Coordinates are in master units
startPoint.X = 0
startPoint.Y = 0
startPoint.Z = 0
‘ Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 2
point.X = (startPoint.X + xdist) + Cos(angle / 2)
point.Y = (startPoint.Y + ydist) * Sin(angle / 2)
point.Z = (startPoint.Z + zdist) * angle / 2
CadInputQueue.SendDataPoint point, 2
‘ Send a reset to the current command
CadInputQueue.SendReset
CommandState.StartDefaultCommand
Next
End Sub