基于autocad VBA自动画wafer map,计算gross die per wafer的详细代码
时间: 2024-02-15 22:02:06 浏览: 359
好的,下面是一个基于AutoCAD VBA的示例代码,用于自动画wafer map并计算gross die per wafer。该示例代码仅供参考,具体实现可能需要根据您的具体需求进行修改。
```
Sub DrawWaferMap()
'设置wafer大小和die大小
Dim waferSize As Double
Dim dieSize As Double
waferSize = 10 'wafer尺寸为10mm
dieSize = 1 'die尺寸为1mm
'计算每个wafer的gross die数量
Dim grossDiePerWafer As Integer
grossDiePerWafer = Application.WorksheetFunction.Floor(Application.WorksheetFunction.Pi() * (waferSize / 2) ^ 2 / dieSize, 1)
'设置wafer map的中心点和偏移量
Dim centerX As Double
Dim centerY As Double
centerX = 0
centerY = 0
Dim offsetX As Double
Dim offsetY As Double
offsetX = 0
offsetY = 0
'绘制wafer圆形
Dim waferCircle As AcadCircle
Set waferCircle = ThisDrawing.ModelSpace.AddCircle(CoordToPoint(centerX, centerY), waferSize / 2)
'计算wafer map的行列数
Dim rowCount As Integer
Dim colCount As Integer
rowCount = Application.WorksheetFunction.Floor((waferSize - 2 * offsetX) / dieSize, 1)
colCount = Application.WorksheetFunction.Floor((waferSize - 2 * offsetY) / dieSize, 1)
'绘制每个die
Dim i As Integer
Dim j As Integer
For i = 1 To rowCount
For j = 1 To colCount
Dim dieCenterX As Double
Dim dieCenterY As Double
dieCenterX = offsetX + (i - 0.5) * dieSize
dieCenterY = offsetY + (j - 0.5) * dieSize
Dim die As AcadCircle
Set die = ThisDrawing.ModelSpace.AddCircle(CoordToPoint(dieCenterX, dieCenterY), dieSize / 2)
Next j
Next i
'输出gross die per wafer数量
MsgBox "Gross die per wafer: " & grossDiePerWafer
End Sub
'将坐标值转换为AutoCAD的点坐标
Function CoordToPoint(ByVal x As Double, ByVal y As Double) As Variant
Dim point(0 To 2) As Double
point(0) = x
point(1) = y
CoordToPoint = point
End Function
```
这段代码会在AutoCAD中绘制一个指定大小的wafer,并在wafer上绘制一系列指定大小的die。同时,它会计算每个wafer的gross die数量,并弹出一个消息框显示gross die per wafer的数量。
需要注意的是,这段代码仅作为示例,您需要根据您的具体需求进行修改和完善。同时,由于自动化绘图和计算gross die数量可能会占用大量计算资源,您需要谨慎使用,并确保您的机器具有足够的性能。
阅读全文