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

Recognizing an open drawing

1 REPLY 1
Reply
Message 1 of 2
mcguirepm
162 Views, 1 Reply

Recognizing an open drawing

I have an application that worked with ACAD 2005, but it has died misreably with 2008. I have updated the references and have worked through some of ths issues, but the code dies on the last line:
[code]
Dim AcadApp As Autodesk.AutoCAD.Interop.AcadApplication
Dim AcadDoc As Autodesk.AutoCAD.Interop.AcadDocument
Dim AcadElement AsObject
Dim ElementArray AsObject
Dim intCounter As Int32
Dim intPartCount As Int32 = 0
Dim AcadObjectLine As AutoCAD_Objects
objBlock = New Collection
Try
AcadApp = GetObject(, "AutoCAD.Application.17.1")
Catch ex As Exception
MsgBox("AutoCAD Application Is Not Running", MsgBoxStyle.Critical, "AutoCAD To M1 Application Error")
Return
EndTry
AcadDoc = AcadApp.ActiveDocument
Dim intCount As Int16 = 0
Dim intTotalItems As Int32 = AcadDoc.ModelSpace.Count
[/code]

The problem is that when I have a drawing open and only one drawing open, the AcadDoc is always "Drawing1.dwg". Becasue it thinks its looking as Drawing1.dwg the ModelSpace.Count returns zero.

Any insights would be greatly appreciated.

Pat
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: mcguirepm

Do you understand what the 'ActiveDocument' property is?

It returns the document that is currently active, regardless of how many are open.

The other thing is that you're posting in the managed ObjectARX newsgroup. You are not using that API, you're using the ActiveX API used by VBA, so that would be a better place to ask about ActiveX with VB.NET.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5857917@discussion.autodesk.com...
I have an application that worked with ACAD 2005, but it has died misreably with 2008. I have updated the references and have worked through some of ths issues, but the code dies on the last line:
[code]
Dim AcadApp As Autodesk.AutoCAD.Interop.AcadApplication
Dim AcadDoc As Autodesk.AutoCAD.Interop.AcadDocument
Dim AcadElement AsObject
Dim ElementArray AsObject
Dim intCounter As Int32
Dim intPartCount As Int32 = 0
Dim AcadObjectLine As AutoCAD_Objects
objBlock = New Collection
Try
AcadApp = GetObject(, "AutoCAD.Application.17.1")
Catch ex As Exception
MsgBox("AutoCAD Application Is Not Running", MsgBoxStyle.Critical, "AutoCAD To M1 Application Error")
Return
EndTry
AcadDoc = AcadApp.ActiveDocument
Dim intCount As Int16 = 0
Dim intTotalItems As Int32 = AcadDoc.ModelSpace.Count
[/code]

The problem is that when I have a drawing open and only one drawing open, the AcadDoc is always "Drawing1.dwg". Becasue it thinks its looking as Drawing1.dwg the ModelSpace.Count returns zero.

Any insights would be greatly appreciated.

Pat

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