.NET

Reply
Member
shamkumar
Posts: 3
Registered: ‎05-02-2012
Message 1 of 3 (318 Views)

error in document object creation

318 Views, 2 Replies
05-08-2012 03:29 AM

using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Interop.Common;
using Autodesk.AutoCAD.Interop;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;

namespace application
{
class Program
{
static void Main(string[] args)
{

Document acDoc = Application.DocumentManager.MdiActiveDocument;

 

}

}

Working Environment:-

  1. Visual Studio 2010
  2. AutoCAD 2011 
  3. C#

 

 

After run following error will occure

 

"

An unhandled exception of type 'System.TypeLoadException' occurred in mscorlib.dll

 

Additional information: Method 'CopyTo' in type 'Autodesk.AutoCAD.ApplicationServices.DocumentCollection'

from assembly 'acmgd, Version=18.1.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation ."

Moderator
Alexander.Rivilis
Posts: 1,449
Registered: ‎04-09-2008
Message 2 of 3 (312 Views)

Re: error in document object creation

05-08-2012 04:48 AM in reply to: shamkumar

I see what you're trying to create a standalone application (exe-file). In this case you can not use AutoCAD. NET API (ie acmgd.dll, acdbmgd.dll, accoremgd.dll, etc)


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Board Manager
StephenPreston
Posts: 419
Registered: ‎05-22-2006
Message 3 of 3 (294 Views)

Re: error in document object creation

05-08-2012 01:40 PM in reply to: Alexander.Rivilis

Although you can license the RealDWG SDK to add DWG capability to your own app. Brief explanation here - http://adndevblog.typepad.com/autocad/2012/03/readingwriting-dwg-files-from-a-standalone-application....

Cheers,

Stephen Preston
Autodesk Developer Network
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!