.NET

Reply
*pkirill
Message 1 of 5 (112 Views)

Opening/Adding Acad document - 2005 vs 2006?

112 Views, 4 Replies
06-01-2005 09:12 AM
Is there something I'm missing between 2005 and 2006? I've got a batch
processor that checks to see if an acad session is running and if so open a
document in that session and if its not running, open AutoCAD and then open
a document. The simple code works fine in AutoCAD 2005, but not with 2006.

This is my sub for detecting the acad session:

Imports Autodesk.AutoCAD.Interop.Common
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.AcadPlotClass

Sub DetectAcadSession()
blnAcadExist = False
' Check to see if Acad is open
On Error Resume Next
acad = GetObject(, "autocad.application") 'try to get the app object
If Err().Number <> 0 Then 'if not then create a new
one
blnAcadExist = False
acad = New AcadApplication
Else
blnAcadExist = True
End If
Err().Clear()
ACADVer = acad.Version.ToString() 'save acad version for later
End Sub


This is the code I use to Open a document:

dwg = acad.Documents.Open(strDwgs(i), False) 'strDwgs(i) is valid

If I step through the code using AutoCAD 2006, it works. If I just run it,
I get "Call Rejected by Callee".
Any help or tips would be greatly appreciated!
New Member
temerson
Posts: 2
Registered: ‎06-22-2005
Message 2 of 5 (112 Views)

Re: Opening/Adding Acad document - 2005 vs 2006?

06-22-2005 09:22 AM in reply to: *pkirill
Did you ever get any response to the issue you are experiencing. I'm having the exact same issue. I have also tested it in debug mode and it works but compiled mode it does not. The same code has worked for AutoCAD 2004 & 2005 but is broken in 2006. Thanks for any help you can give me...
New Member
temerson
Posts: 2
Registered: ‎06-22-2005
Message 3 of 5 (112 Views)

Re: Opening/Adding Acad document - 2005 vs 2006?

06-22-2005 10:59 AM in reply to: *pkirill
I was able to get my code running by looping until autocad is idle then open the file. The following example is for VB 6.0

' GET AUTOCAD STATE. NOTE: AutoCAD.AcadState OBJECT
Set oState = oApp.GetAcadState
If Not oState Is Nothing Then
Do While oState.IsQuiescent = False
DoEvents
Loop
End If
*pkirill
Message 4 of 5 (112 Views)

Re: Opening/Adding Acad document - 2005 vs 2006?

06-22-2005 12:57 PM in reply to: *pkirill
And here's what I used in .NET:

Dim AcState As AcadState
Dim blnAcState As Boolean = False

While blnAcState = False
AcState = acad.GetAcadState
If AcState.IsQuiescent Then
blnAcState = True
End If
End While

Same solution, basically...

wrote in message news:4882190@discussion.autodesk.com...
I was able to get my code running by looping until autocad is idle then open
the file. The following example is for VB 6.0

' GET AUTOCAD STATE. NOTE: AutoCAD.AcadState OBJECT
Set oState = oApp.GetAcadState
If Not oState Is Nothing Then
Do While oState.IsQuiescent = False
DoEvents
Loop
End If
*Tony Tanzillo
Message 5 of 5 (112 Views)

Re: Opening/Adding Acad document - 2005 vs 2006?

06-22-2005 01:22 PM in reply to: *pkirill
Sometimes you just have to poke around a bit
to find the managed API equivalent:

Autodesk.AutoCAD.ApplicationServices.Application.IsQuiescent

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"pkirill" wrote in message news:4882466@discussion.autodesk.com...
And here's what I used in .NET:

Dim AcState As AcadState
Dim blnAcState As Boolean = False

While blnAcState = False
AcState = acad.GetAcadState
If AcState.IsQuiescent Then
blnAcState = True
End If
End While

Same solution, basically...

wrote in message news:4882190@discussion.autodesk.com...
I was able to get my code running by looping until autocad is idle then open
the file. The following example is for VB 6.0

' GET AUTOCAD STATE. NOTE: AutoCAD.AcadState OBJECT
Set oState = oApp.GetAcadState
If Not oState Is Nothing Then
Do While oState.IsQuiescent = False
DoEvents
Loop
End If

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community