在VB中写CAD二次开发程序,困难 大呀,谁能帮忙解决这个问题
<P>Private Sub Command1_Click()</P><P><BR>Dim Pt1(0 To 2) As Double<BR>Dim Pt2(0 To 2) As Double</P>
<P>On Error Resume Next<BR> <BR> ' 连接至 AutoCAD 应用程序<BR> Dim acadApp As AcadApplication<BR> Set acadApp = GetObject(, "AutoCAD.Application.16")<BR> If Err Then<BR> Err.Clear<BR> Set acadApp = CreateObject("AutoCAD.Application.16")<BR> If Err Then<BR> MsgBox Err.Description<BR> Exit Sub<BR> End If<BR> End If<BR> <BR> ' 连接至 AutoCAD 图形<BR> Dim acadDoc As AcadDocument<BR> Set acadDoc = acadApp.ActiveDocument<BR>Dim ptpick5 As Variant<BR>Dim ptpick6 As Variant<BR> ptpick5 = acadDoc.ModelSpace.Utility.GetPoint(, "请拾取第一点吊点位置:")<BR> ptpick6 = acadDoc.ModelSpace.Utility.GetPoint(, "请拾取第二点吊点位置:")<BR> Pt1(0) = ptpick5(0)<BR> Pt1(1) = ptpick5(1)<BR> Pt1(2) = 0<BR> Pt2(0) = ptpick6(0)<BR> Pt2(1) = ptpick6(1)<BR> Pt2(2) = 0<BR>Set plineobj = acadDoc.ModelSpace.AddLine(Pt1, Pt2)<BR>ZoomAll<BR> acadApp.Visible = True<BR>End Sub</P>
<P>以上代吗 不能和CAD进行交互,在VBA中可以,谁能帮忙在VB中实现同样的功能?谢谢</P>
页:
[1]