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

Civil3D 2011 initialization fails

3 REPLIES 3
Reply
Message 1 of 4
aknigin
1119 Views, 3 Replies

Civil3D 2011 initialization fails

I use the following code to initialize Autocad (Civil3d) application:

{code}
static void Main(string[] args)
{
try
{
//initializing application
Autodesk.AutoCAD.Interop.AcadApplication acad = null;
try
{
acad = (Autodesk.AutoCAD.Interop.AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.18.1");
}
catch (System.Exception ex)
{
//not started yet? start a new one
acad = new Autodesk.AutoCAD.Interop.AcadApplication();
}

acad.Visible = true;
//no documents open? open a new document
if (acad.Documents.Count == 0)
{
acad.Documents.Add("");
}
}
catch (System.Exception ex)
{
string msg = "Fail: " + ex.Message;
System.Diagnostics.Trace.WriteLine(msg);
}
}
{code}

If the application isn't running yet, instead of get it started I get error "The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))".
The same code (with different type string of course) for Civil3d 2009 usually works normally. Sometimes if the Civil3d 2009 starts for the first time, the starting time exceeds timeout (120 seconds), and the program also fails, but at least I have known reason here.
3 REPLIES 3
Message 2 of 4
GTVic
in reply to: aknigin

Do you have an add-in menu with an associated MNL file?

All MNL file contents should be wrapped in the following so they don't execute in automation mode:
{code}
(vl-load-com)
(if (= :vlax-true (vlax-get-property (vlax-get-acad-object) 'Visible)) (progn
; place MNL code here
)) ; end of code processed only if AutoCAD is visible
{code}
Message 3 of 4
Anonymous
in reply to: aknigin

Search Kean's blog for 'IMessageFilter'.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6400307@discussion.autodesk.com...
I use the following code to initialize Autocad (Civil3d) application:

{code}
static void Main(string[] args)
{
try
{
//initializing application
Autodesk.AutoCAD.Interop.AcadApplication acad = null;
try
{
acad =
(Autodesk.AutoCAD.Interop.AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.18.1");
}
catch (System.Exception ex)
{
//not started yet? start a new one
acad = new Autodesk.AutoCAD.Interop.AcadApplication();
}

acad.Visible = true;
//no documents open? open a new document
if (acad.Documents.Count == 0)
{
acad.Documents.Add("");
}
}
catch (System.Exception ex)
{
string msg = "Fail: " + ex.Message;
System.Diagnostics.Trace.WriteLine(msg);
}
}
{code}

If the application isn't running yet, instead of get it started I get error "The
message filter indicated that the application is busy. (Exception from HRESULT:
0x8001010A (RPC_E_SERVERCALL_RETRYLATER))".
The same code (with different type string of course) for Civil3d 2009 usually
works normally. Sometimes if the Civil3d 2009 starts for the first time, the
starting time exceeds timeout (120 seconds), and the program also fails, but at
least I have known reason here.
Message 4 of 4
aknigin
in reply to: Anonymous

I've tried the approach which is described in Kean's article. On Civil3D 2010 it works correctly, but when I try to start 2011 version this way, I get the following exception: Retrieving the COM class factory for component with CLSID {C92FB640-AD4D-498A-9979-A51A2540C977} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

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