AcMapMap problem in Civil3d 2011

AcMapMap problem in Civil3d 2011

Anonymous
Not applicable
1,451 Views
3 Replies
Message 1 of 4

AcMapMap problem in Civil3d 2011

Anonymous
Not applicable

I have simple program that look like this

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Gis.Map.Platform.Interop;
using Autodesk.Gis.Map.Platform;
using Autodesk.AutoCAD.Runtime;
using OSGeo.MapGuide;

namespace probaAcMapMap
{
    public class Class1
    {
        [CommandMethod("nesto")]
        public void nesto()
        {
            AcMapMap map = AcMapMap.GetCurrentMap();
        }
    }
}

 

 

 

and I'm getting this exception "Failed to retrieve message for "MgInvalidArgumentException"."

This code is working just fine in 2010 and VS2008.

This code is builded with VS2010

 

Am I missing some reference or what?

0 Likes
Accepted solutions (1)
1,452 Views
3 Replies
Replies (3)
Message 2 of 4

norman.yuan
Mentor
Mentor

I tried your code with my AcadMap2011 and VS2010 (the project is set to target .NET4.0). It compiles OK and runs OK (this is the sigle line of code "AcMapAmp map=....' does not cause exception).

 

I believe civil3d 2011 has all AcadMap2011 functionalities plus more.

 

Well, to allow AcadMap2011 work with .NET 4.0, I have this in acad.exe.config:

 

<configuration>
 <startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0"/>
 </startup>

...

</configuration>

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 4

Anonymous
Not applicable

I kindly figured out the problem. When I compile the program and start it, he throw an error. If I do that again (fresh start) except I call mapwspace command and than call my program, its ok.

I think it is because the map it is not initialized or something. If I look in my text window with F2 I saw some command like this MAPDMDWGLOADED??? 

 

 

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

I figured out. Reinstall solved the problem 🙂

0 Likes