Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.NET v4.0 COM Interop. Can't get Database via late bind? C3D 2012 SP1

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
rutar
532 Views, 2 Replies

.NET v4.0 COM Interop. Can't get Database via late bind? C3D 2012 SP1

Hello!

 

After resolving trouble with versions changing 107->49, AecXBase, AecXUIBase are now visible, 

 

I have another one -  m_oAeccDoc.GetType().GetProperty("Database") is null,

 

in .NET version 3.5 - all works fine,

it happens after changing to .NET version 4.0 and references  to newer ones.



________________________________________________________________________________________

m_oAcadApp = (IAcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject(m_sAcadProdID);
if (m_oAcadApp != null)
{
m_oAeccApp = (IAeccApplication)m_oAcadApp.GetInterfaceObject(m_sAeccAppProgId);
m_oAeccDoc = (IAeccDocument)m_oAeccApp.ActiveDocument;


// get the Database object via a late bind - here m_oAeccDoc.GetType().GetProperty("Database") is null

m_oAeccDb = (Autodesk.AECC.Interop.Land.IAeccDatabase)m_oAeccDoc.GetType().GetProperty("Database").GetValue(m_oAeccDoc, null);
}

_________________________________________________________________________________________

 

Is any possibility to change "Using Interop" Autodesk API Developers guide from .NET 3.5 2010, to v4.0 2012 and also Samples directory files  or  write somwhere  how to use  COM Interop in C3D2012 SP1?

2 REPLIES 2
Message 2 of 3
tomg
in reply to: rutar

Take a look at the Answer Solution C# DotNetComInterop Sample.

 

Tom

Message 3 of 3
rutar
in reply to: tomg

Thanks, tomg.

 

I'd applyed that registry modification (107->49 version) before, to have AecXBase, AecXUIBase visible.

 

Now changed in  C# ProjectOptions target .NET framework version to 3.5 - all works, 

and it possible to load that dll via netload  and run

in C3D 2012 (autocad.config - using .NET version 4.0) all works fine.

 

 

Is it normal application behaivior?

 

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report