初学vb.net,在2010里画线的例子
本帖最后由 shirazbj 于 2011-9-10 18:56 编辑Public Class Form1
Dim acadapp As Autodesk.AutoCAD.Interop.AcadApplication
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call bj_linkautocad()
Call bj_draw()
End Sub
Sub bj_linkautocad()
On Error Resume Next
acadapp = GetObject(, "autocad.application")
If Err.Number Then
Err.Clear()
acadapp = CreateObject("autocad.application")
If Err.Number Then
MsgBox("Can't start AutoCAD")
Exit Sub
End If
End If
acadapp.Visible = True
AppActivate(acadapp.Caption)
End Sub
Sub bj_draw()
Dim points(3) As Double
Dim plineobj(1) As Autodesk.AutoCAD.Interop.Common.AcadLWPolyline
points(0) = 0 : points(1) = 0
points(2) = 100 : points(3) = 100
plineobj(0) = acadapp.ActiveDocument.ModelSpace.AddLightWeightPolyline(points)
End Sub
End Class
用的vb.net express 2008, 在autocad 2010里从(0,0)-(100,100)画了一条线.
发贴何意?
页:
[1]