Here is exactly what I am trying:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim MyAcad As Autodesk.AutoCAD.Interop.AcadApplication
Dim ThisDrawing As Autodesk.AutoCAD.Interop.AcadDocument
ThisDrawing = MyAcad.ActiveDocument ' (I get an error here stating MyAcad
has not been set)
MsgBox(ThisDrawing.Name)
End Sub
End Class
"Nate Hunter" wrote in message
news:5019338@discussion.autodesk.com...
I tried:
Dim acadApp As AcadApplication
Dim acadDoc As AcadDocument
I am using the COM reference of AutoCAD 2006 Type Library.
Should I be using something else.
When I do the above AcadApplication & AcadDocument are not recognised.
I better stop writing applications. I thought VB6 to VB.Net was suppose to
be a seamless transition. Sorry I am venting a little.
Nate
wrote in message news:5017208@discussion.autodesk.com...
I have created the function as show beneath in VB.Net 2003, it functions
wel:
Friend Function DrawLine2D(ByVal StartPoint As Point2d, ByVal
EndPoint As Point2d, ByVal Layer As AcadLayer) As AcadLine
Dim acadApp As AcadApplication
Dim acadDoc As AcadDocument
Dim nLine As AcadLine
Try
acadApp =
CType(Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication,
AcadApplication)
acadApp.Visible = True
acadDoc = acadApp.ActiveDocument
acadDoc.Application.Visible = True
nLine =
acadDoc.ModelSpace.AddLine(Point2DToArray3D(StartPoint),
Point2DToArray3D(EndPoint))
nLine.Layer = Layer.Name
Return nLine
Catch ex As Exception
MessageBox.Show(ex.ToString)
Return nLine
End Try
End Function
Maybe it helps you, otherwise come back again
Harold van Aarsen