首先要引用dll:
Imports AutoCAD
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = New AutoCAD.AcadApplication
a.Visible = True
'------------------------------------------外框
DL(New Double() {x0, y0 + jk, 0}, New Double() {x0, y0 + wh - jk, 0}) '左竖
DL(New Double() {x0 + ww, y0 + jk, 0}, New Double() {x0 + ww, y0 + wh - jk, 0}) '右竖
DL(New Double() {x0 + jk, y0, 0}, New Double() {x0 + jk + ww - jk * 2, y0, 0}) '下线
DL(New Double() {x0 + jk, y0 + wh, 0}, New Double() {x0 + jk + ww - jk * 2, y0 + wh, 0}) '上线
......
end sub
Sub DL(ByVal sp() As Double, ByVal ep() As Double)
Try
a.ActiveDocument.ModelSpace.AddLine(sp, ep)
Catch
MsgBox("line")
DL(sp, ep)
End Try
End Sub