打开一个cad文档,在VB中执行以下语句,再看看CAD文档。。。如果你懂VBA,应该很容易明白其它的该怎么做,如果不明白,要仔细看看CAD的对象模型部分
Private Sub SetSupportPath() Dim acadApp As Object Dim startPoint(0 To 2) As Double Dim endPoint(0 To 2) As Double
' Define the start and end points for the line startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0# endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#
' Create the line in model space
Set acadApp = GetObject(, "AutoCAD.Application") acadApp.ActiveDocument.ModelSpace.AddLine startPoint, endPoint End Sub