.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

start AutoCAD and open dwg-files

1 REPLY 1
Reply
Message 1 of 2
Anonymous
601 Views, 1 Reply

start AutoCAD and open dwg-files

Hello,
I work with VB.Net 2008, AutoCAD 2007 and Autodesk ObjectARX
(Autodesk.AutoCAD.Interop.dll, Autodesk.AutoCAD.Interop.Common.dll).

I have three problems:

1. How I get the information if AutoCAD open? (I want have only one
session.)
2. How I can open a dwg-file?
3. How I get the information which dwg-files are opening?

Thanks.
Hartmut
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

1.
{code}
m_sAcadProdID = "AutoCAD.Application"
Try
If IsNothing(m_oAcadApp) Then
m_oAcadApp = GetObject(, "Autocad.Application")
End If
Catch exc As Exception

Dim AcadProg As System.Type
AcadProg = System.Type.GetTypeFromProgID(m_sAcadProdID)
m_oAcadApp = System.Activator.CreateInstance(AcadProg, True)
'Instead above two lines of code, simply use following new ().
'However, this always creates an instance of the
'AutoCAD even if it is already running.
'm_oAcadApp = new AutoCAD.AcadApplicationClass();

Dim sMessage As String
sMessage = exc.Message.ToString() ' to avoid from complier warning.
End Try

If IsNothing(m_oAcadApp) = False Then
m_oAcadApp.Visible = True
Project_Statistics_Btn.Enabled = True
End If{code}

2. once you have the instance of autocad you can call m_oAcadApp.Documents.Open()

3. by accessing the documents through m_oAcadApp.Documents

All this info is available in the ObjectARX SDK which i recommend you download.
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1911627

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost