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: 

AeccXUiLand.AeccApplication

44 REPLIES 44
SOLVED
Reply
Message 1 of 45
Anonymous
7975 Views, 44 Replies

AeccXUiLand.AeccApplication

11.0 is what I've been using Civil 3D 2017.

Const m_sAcadAppId As String = "AeccXUiLand.AeccApplication.11.0"

Const m_sSurveyAppId As String = "AeccXUiSurvey.AeccSurveyApplication.11.0"

 

What is the number for Civil 3D 2019?

Is there a variable in the .Net API to find this number?

44 REPLIES 44
Message 2 of 45
rkmcswain
in reply to: Anonymous

See the lisp code in the second post here for one way to do it.

2018, 12.0

2019, 13.0

2020, 13.2

 

If you just want to view it, run the command AECCVERSION.

R.K. McSwain     | CADpanacea | on twitter
Message 3 of 45
Jeff_M
in reply to: Anonymous

@Anonymous , change how you get the AeccApplication and you will never need to worry about the version number again. From the C3DReports source code:

 

    Public Shared ReadOnly Property AeccXApplication() As AeccXUiLand.IAeccApplication
        Get
            If (_aeccXApplication Is Nothing) Then
                Dim acadApp As Autodesk.AutoCAD.Interop.IAcadApplication
                acadApp = CType(AcMgApp.Application.AcadApplication, Autodesk.AutoCAD.Interop.IAcadApplication)

                _aeccXApplication = New AeccXUiLand.AeccApplication
                _aeccXApplication.Init(CType(acadApp, Autodesk.AutoCAD.Interop.AcadApplication))
            End If
            Return _aeccXApplication
        End Get
    End Property

Or, using c#, this is what I've been using for many years now:

        public AeccApplication AeccApp
        {
            get
            {
                if (aeccApp == null)
                {
                    aeccApp = new AeccApplication();
                    aeccApp.Init((AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication);
                }
                return aeccApp;
            }
        }
Jeff_M, also a frequent Swamper
EESignature
Message 4 of 45
Anonymous
in reply to: rkmcswain

Thanks

Message 5 of 45
Anonymous
in reply to: Jeff_M

This is great. Thanks.

Message 6 of 45
GTVic
in reply to: Jeff_M

Hi Jeff,

 

Thanks for this. I'm a little confused with the details, What is AeccXUiLand? Is it a substitute for Autodesk.AECC.Interop.UiLand?

 

For Autodesk.AECC.Interop.UiSurvey.AeccSurveyApplication, this is what I've been using:

 

Dim oAeccSurveyApp As Object = Nothing
Dim oAeccSurveyDoc As Object = Nothing
Dim oAeccSurveyDB As Autodesk.AECC.Interop.Survey.AeccSurveyDatabase = Nothing
Dim oAcadApp As Autodesk.AutoCAD.Interop.AcadApplication = Nothing
Dim sKeyAcadProfiles As String = HostApplicationServices.Current.UserRegistryProductRootKey
If (sKeyAcadProfiles.Contains("R20.1\ACAD-F000")) Then m_sAeccSvAppProgId = "AeccXUiSurvey.AeccSurveyApplication.10.5"
' more If statements here for other versions
oAcadApp = ApplicationServices.Application.AcadApplication oAeccSurveyApp = oAcadApp.GetInterfaceObject(m_sAeccSvAppProgId)
oAeccSurveyDoc = oAeccSurveyApp.ActiveDocument
oAeccSurveyDB = oAeccSurveyApp.ActiveDocument.Database

But the problem I have is if I used Autodesk.AECC.Interop.UiSurvey.AeccSurveyApplication instead of Object in the above code, the resulting DLL would only work in the version I was developing for (2016). Changing to Object allows the DLL to work with multiple versions.

 

 

Thanks

Message 7 of 45
Jeff_M
in reply to: GTVic

@GTVic  the AeccXUiLand is what the developers at Autodesk called in their Imports in the C3DReport code:

Imports AeccXUiLand = Autodesk.AECC.Interop.UiLand

 

This is what I use for the SurveyApplication, no if statements for versions needed:

    public sealed class AeccSurvAppConnection
    {
        private AeccSurveyApplication survApp = null;
        public AeccSurvAppConnection() { }

        public AeccSurveyApplication SurvApp
        {
            get
            {
                if (survApp == null)
                {
                    survApp = new AeccSurveyApplication();
                    survApp.Init((AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication);
                }
                return survApp;
            }
        }

        public AeccSurveyDocument SurvDoc
        {
            get 
            { 
                return (AeccSurveyDocument)SurvApp.ActiveDocument; 
            }
        }

        public AeccSurveyDatabase SurvDb
        {
            get
            {
                return (AeccSurveyDatabase)SurvApp.ActiveDocument.Database;
            }
        }
    }
Jeff_M, also a frequent Swamper
EESignature
Message 8 of 45
GTVic
in reply to: Jeff_M

Hi Jeff,

Thanks for the post. I wasn't successful under my deadline with a complicated project, maybe I'll put together a simple sample project that does some basic operations and post it here and if we get it working could be useful as a template for future projects.

Greg

Message 9 of 45
joaogoncalosantos
in reply to: Jeff_M

Boa Tarde,

 

Meu nome é João

 

Desenvolvi para uso próprio, em vba, no Autocad civil 3d 2019, um pequeno aplicativo.

Roda perfeitamente no 2019, mas. não funciona em nenhuma outra versão, diz erro em tempo de execução

tipos incompatíveis, 

Const sAppName = "AeccXUiLand.AeccApplication.13.0"
Set g_oCivilApp = oApp.GetInterfaceObject(sAppName)
Set g_oDocument = g_oCivilApp.ActiveDocument

pode me ajudar?

 

João Gonçalo

Message 10 of 45
GTVic
in reply to: joaogoncalosantos

VBA Code:

 

Dim m_Id As String
Dim Version as String

Version = ThisDrawing.Application.Version
m_Id = ""

If (Instr(Version, "19.0") > 0) Then m_Id = "10.0" ' 2013
If (Instr(Version, "19.1") > 0) Then m_Id = "10.3" ' 2014
If (Instr(Version, "20.0") > 0) Then m_Id = "10.4" ' 2015
If (Instr(Version, "20.1") > 0) Then m_Id = "10.5" ' 2016
If (Instr(Version, "21.0") > 0) Then m_Id = "11.0" ' 2017
If (Instr(Version, "22.0") > 0) Then m_Id = "12.0" ' 2018
If (Instr(Version, "23.0") > 0) Then m_Id = "13.0" ' 2019
If (Instr(Version, "23.1") > 0) Then m_Id = "13.2" ' 2020

If m_Id <> "" Then
    Set g_oCivilApp = oApp.GetInterfaceObject("AeccXUiLand.AeccApplication." & m_Id)
    Set g_oSurveyApp = oApp.GetInterfaceObject("AeccXUiSurvey.AeccSurveyApplication." & m_Id)
    Set g_oCivilDocument = g_oCivilApp.ActiveDocument 
    Set g_oSurveyDocument = g_oSurveyApp.ActiveDocument 
End If
Message 11 of 45
joaogoncalosantos
in reply to: GTVic

Obrigado pela ajuda, só mais uma pergunta, onde devo adicionar este código?

 

 

João Gonçalo

Message 12 of 45
jrWB953
in reply to: Jeff_M

Hi @Jeff_M ,

 

This solution has been working well for a while...

But, when C3D 2021 is installed, it stopped working:

 

 

 

public static AeccApp CurrAeccAppInstance()
{
Autodesk.AECC.Interop.UiLand.AeccApplication retVal = new Autodesk.AECC.Interop.UiLand.AeccApplication();
if(retVal != null)
{
retVal.Init((Autodesk.AutoCAD.Interop.AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication);
}
return retVal;
}

 

 

 

It throws the following

 

 

 

'acad.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\Autodesk\AutoCAD 2021\C3D\Autodesk.AECC.Interop.UiLand.dll'. Module was built without symbols.

...
"Retrieving the COM class factory for component with CLSID {E933000F-0085-4186-8DF9-3D5372B7DC57} failed due to the following error: 8007045a A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)."

dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A).
at Civil3DPluggin.Commands.CurrAeccAppInstance() in C:\Development\ACAD_ObjectARX\Civil3DPluggin\Civil3DPluggin\Commands.cs:line 1607
>> Autodesk.AECC.Interop.UiLand.AeccApplication retVal = new Autodesk.AECC.Interop.UiLand.AeccApplication(); <<
Exception thrown: 'System.IO.FileLoadException' in Civil3DPluggin.dll

 

 

 

The DLL is installed, The registry key's are there, it should be OK...

But there is an IO exception loading the DLL, it seems like...

 

Any Ideas would be greatly appreciated...

Thanks

 JR

Message 13 of 45
Jeff_M
in reply to: jrWB953

@jrWB953 I've been using the same process for years without issues. Still works in C3D 2021 for me. If this is occurring when you are wanting to run a Debug session, make sure the option to "Enable Just My Code" is checked.

2021-03-03_8-46-14.jpg

Jeff_M, also a frequent Swamper
EESignature
Message 14 of 45
jrWB953
in reply to: Jeff_M

Hi @Jeff_M ,

 

Thank you for the reply...

I did that...It did not change the outcome.

I've removed all the libraries and re-added.

Completely removed C3D-2020, ArcX libs 2020.

 

The Error changed to:

 

"Retrieving the COM class factory for component with CLSID {E933000F-0085-4186-8DF9-3D5372B7DC57} failed due to the following error: 8007045a A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)."

 

"E933000F-0085-4186-8DF9-3D5372B7DC57" -> C:\Program Files\Autodesk\AutoCAD 2021\C3D\AeccXUiLand.dll

 

I'm out of ideas at this point...

Any insight would be really appreciated...

 

Message 15 of 45
Jeff_M
in reply to: jrWB953

@jrWB953 Any chance you can share the project, or a stripped down version that still exhibits the same issue?

Jeff_M, also a frequent Swamper
EESignature
Message 16 of 45
jrWB953
in reply to: Jeff_M

@Jeff_M ,

Thanks for replying,

 

Unfortunately, I can't share the whole thing...

But, I can try to make a Slim-down...

I guess the one thing I can try is to create a new project from scratch and add the code in...

 

The main portion, that fails, looks like:

 

using IAeccDoc = Autodesk.AECC.Interop.UiLand.IAeccDocument;
using IAeccDB = Autodesk.AECC.Interop.Land.IAeccDatabase;
using AeccApp = Autodesk.AECC.Interop.UiLand.AeccApplication;
using IAeccApp = Autodesk.AECC.Interop.UiLand.IAeccApplication;
using IAeccUDPClass = Autodesk.AECC.Interop.Land.AeccUserDefinedPropertyClassifications;
using IAeccUDP = Autodesk.AECC.Interop.Land.AeccUserDefinedProperty;
...

        // Modal Command with localized name
        public int SummaryTables(String fileName, bool includecosts = false, bool clean = false) 
        {
...
             IAeccDB aeccdb = IAeccDBInstance;
           // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
        }

        // ***************************************************************************************
        [CommandMethod(CMD_GROUP_EDSA, CMD_SUMMARY, "SUMMARY", CommandFlags.Modal)]
        public void SummaryTables() 
        {   // Should be called as : _COGOSUMBYDKS 
            try
            {
                SummaryTables(MISSING_PARAMETER_INDICATOR);
            }
            catch (System.Exception ex)
            {
                HandleException(ex, CMD_SUMMARY);
            }
        }

        [LispFunction(CMD_SUMMARY, "SUMMARYLspId")]
        public int SummaryTableslLsp(ResultBuffer args) 
        {   // Should be called as : (PARCELSUM "C:/TEMP/XXXCogo.html")
            int retVal = 0;
            String stringParam1 = MISSING_PARAMETER_INDICATOR;
            try
            {
                if (args != null)
                {
                    Array argsArray = args.AsArray();
                    if (argsArray.Length > 0)
                    { stringParam1 = Convert.ToString(((TypedValue)(argsArray.GetValue(0))).Value); }
                }
                retVal = SummaryTables(stringParam1);
            }
            catch (System.Exception ex)
            {
                HandleException(ex, "_COGOSUMBYDKS(lsp)");
            }
            return retVal;
        }

...
        public static AeccApp CurrAeccAppInstance()
        {
            Autodesk.AECC.Interop.UiLand.AeccApplication retVal = new Autodesk.AECC.Interop.UiLand.AeccApplication();
// This is what fails^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            if(retVal != null)
            {
                retVal.Init((Autodesk.AutoCAD.Interop.AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication);
            }
            return retVal;
        }

        public static IAeccDB CurrIAeccDBInstance()
        {
            IAeccDB retVal = null;
            AeccApp currapp = CurrAeccAppInstance();
            if (currapp != null)
            {
                IAeccDoc currdoc = (IAeccDoc)currapp.ActiveDocument;
                if (currdoc != null)
                {
                    retVal = (IAeccDB)currdoc.GetType().GetProperty("Database").GetValue(currdoc, null);
                }
            }
            return retVal;
        }

        // ****************************************************************************
        private AeccApp _AeccApp = null;
        protected AeccApp AeccAppInstance
        {
            get
            {
                if (_AeccApp == null)
                { // https://forums.autodesk.com/t5/civil-3d-customization/aeccxuiland-aeccapplication/td-p/8775478
                    _AeccApp = CurrAeccAppInstance();
                }
                return _AeccApp;
            }
        }

        protected IAeccDoc AeccDocInstance
        {
            get
            {
                if (AeccAppInstance != null)
                { return (IAeccDoc)AeccAppInstance.ActiveDocument; }
                return null;
            }
        }

        private IAeccDB _AeccDB = null;
        protected IAeccDB IAeccDBInstance
        {
            get
            {
                if (_AeccDB == null)
                {
                    IAeccDoc currdoc = AeccDocInstance;
                    if (currdoc != null)
                    {
                        _AeccDB = (IAeccDB)currdoc.GetType().GetProperty("Database").GetValue(currdoc, null);
                    }
                }
                return _AeccDB;

            }
        }

 

 

Message 17 of 45
jrWB953
in reply to: jrWB953

Hi @Jeff_M ,

 

Sooo...

I removed Visual Studio, ObjectArcX, Wizzards,  and all the AutoCAD stuff.

Re-Installed everything, rebuilt the project from scratch both manually and using the Wizzards.

Still the exact same problem, which took quite a while.

 

I checked all include paths and all the usual suspects...Still Nada..

 

I created a BareBones project, which display's the same symptom...

So if anyone has any ideas I would be eternally grateful.

  JR

Message 18 of 45
Jeff_M
in reply to: jrWB953

@jrWB953 have you installed the updates for C3D 2021? Your barebones loads and runs until it tries the get the AeccDatabase. It then fails, but I recalled also running into that sometime ago. We fixed that issue by not using a variable set to the ActiveDocument, instead using this:

        public static AeccDB CurrAeccDBInstance()
        {
            AeccDB retVal = null;
            AeccApp currapp = CurrAeccAppInstance();
            if (currapp != null)
            {
                retVal = (AeccDB)currapp.ActiveDocument.Database;
            }
            return retVal;
        }

 

Once I made that change (I also removed all Interface refences, hence the AeccDB instead of IAeccDB that you had), it runs right through:

NETLOAD
Command: MYCOMMAND
Hello, this is your first command.

Jeff_M, also a frequent Swamper
EESignature
Message 19 of 45
joaogoncalosantos
in reply to: Anonymous

Obrigado a todos, consegui resolver com ajuda de vocês.

 

Aproveitando o momento, uso o VBA para desenvolver o aplicativo, como faço pra acessar os lados de uma parcela e extrair os azimutes e distâncias e adicionar em uma listbox?

 

Obrigado

 

João Gonçalo

Message 20 of 45
jrWB953
in reply to: Jeff_M

Hi @Jeff_M,

 

Thanks for looking into this ....

I still get an error:

public static AeccApp CurrAeccAppInstance()
{
>>>	Autodesk.AECC.Interop.UiLand.AeccApplication retVal = new Autodesk.AECC.Interop.UiLand.AeccApplication();
	if (retVal != null)
	{
		retVal.Init((Autodesk.AutoCAD.Interop.AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication);
	}
	return retVal;
}


CLSID {E933000F-0085-4186-8DF9-3D5372B7DC57} -> C:\Program Files\Autodesk\AutoCAD 2021\C3D\AeccXUiLand.dll
************** Exception Text **************
System.IO.FileLoadException: Retrieving the COM class factory for component with CLSID {E933000F-0085-4186-8DF9-3D5372B7DC57} failed due to the following error: 8007045a A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A).
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Civil3DBareBones.MyCommands.CurrAeccAppInstance() in C:\Development\Civil2021\Civil3DBareBones\Civil3DBareBones\myCommands.cs:line 73
   at Civil3DBareBones.MyCommands.CurrAeccDBInstance() in C:\Development\Civil2021\Civil3DBareBones\Civil3DBareBones\myCommands.cs:line 99
   at Civil3DBareBones.MyCommands.MyCommand() in C:\Development\Civil2021\Civil3DBareBones\Civil3DBareBones\myCommands.cs:line 50
   at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
   at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
   at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
   at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()



#region Assembly Autodesk.AECC.Interop.UiLand, Version=13.3.0.0, Culture=neutral, PublicKeyToken=null
// C:\Program Files\Autodesk\AutoCAD 2021\C3D\Autodesk.AECC.Interop.UiLand.dll
#endregion

using System.Runtime.InteropServices;

namespace Autodesk.AECC.Interop.UiLand
{
    [CoClass(typeof(AeccApplicationClass))]
    [Guid("E9330002-0085-4186-8DF9-3D5372B7DC57")]
    public interface AeccApplication : IAeccApplication
    {
    }
}

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report