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

AcMapMap problem in Civil3d 2011

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
kob4lt
1231 Views, 3 Replies

AcMapMap problem in Civil3d 2011

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?

3 REPLIES 3
Message 2 of 4
norman.yuan
in reply to: kob4lt

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

Message 3 of 4
kob4lt
in reply to: norman.yuan

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??? 

 

 

Message 4 of 4
kob4lt
in reply to: kob4lt

I figured out. Reinstall solved the problem 🙂

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

Post to forums  

Autodesk Design & Make Report

”Boost