.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error with my first example

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
485 Views, 6 Replies

Error with my first example

Hello,
I'm trying with this simple code:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.PlottingServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using System.Collections.Specialized;


namespace ACADConverter
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Starting Plot");
try
{


Database db = new Database(false, true);
db.ReadDwgFile("c:\\caddo.dwg", FileShare.Read, true, null);
}
catch (FileNotFoundException fnfe)
{
Console.WriteLine("Errore: " + fnfe.StackTrace);
}
}
}
}

But I got this error:


Unhandled Exception: System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at ACADConverter.Program.Main(String[] args)

I had imported this libs:
-acdbmgd
-acmgd
-System
-System.Drawing
-System.Xml

I use AutoCAD 2007

Thank you.

Alfredo
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Are you running a stand-alone application (Console App)? If yes, the error
is expected. You cannot use Acad ObjectARX .NET API outside Acad (that is,
the references you set to acdbmgd.dll/acmgd.dll is useless in your
stand-alone program).


wrote in message news:5664672@discussion.autodesk.com...
Hello,
I'm trying with this simple code:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.PlottingServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using System.Collections.Specialized;


namespace ACADConverter
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Starting Plot");
try
{


Database db = new Database(false, true);
db.ReadDwgFile("c:\\caddo.dwg", FileShare.Read, true, null);
}
catch (FileNotFoundException fnfe)
{
Console.WriteLine("Errore: " + fnfe.StackTrace);
}
}
}
}

But I got this error:


Unhandled Exception: System.IO.FileNotFoundException: The specified module
could not be found. (Exception from HRESULT: 0x8007007E)
at ACADConverter.Program.Main(String[] args)

I had imported this libs:
-acdbmgd
-acmgd
-System
-System.Drawing
-System.Xml

I use AutoCAD 2007

Thank you.

Alfredo
Message 3 of 7
Anonymous
in reply to: Anonymous

The only way to use the AutoCAD Managed API is
from a DLL that is loaded into AutoCAD using the
NETLOAD command.

You must create a new ClassLibrary project, and
then use the NETLOAD command to load it.

The equivalent of the 'Main()' entry point, is the
IExtensionApplication.Initialize method, or you
can define a with the [CommandMethod] attribute,
and enter the command to run your code.

You should download and look at the examples
that ship with the ObjectARX API first.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5664672@discussion.autodesk.com...
Hello,
I'm trying with this simple code:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.PlottingServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using System.Collections.Specialized;


namespace ACADConverter
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Starting Plot");
try
{


Database db = new Database(false, true);
db.ReadDwgFile("c:\\caddo.dwg", FileShare.Read, true, null);
}
catch (FileNotFoundException fnfe)
{
Console.WriteLine("Errore: " + fnfe.StackTrace);
}
}
}
}

But I got this error:


Unhandled Exception: System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at ACADConverter.Program.Main(String[] args)

I had imported this libs:
-acdbmgd
-acmgd
-System
-System.Drawing
-System.Xml

I use AutoCAD 2007

Thank you.

Alfredo
Message 4 of 7
Anonymous
in reply to: Anonymous

That mean I cannot run nothing outside AutoCAD?
Message 5 of 7
Anonymous
in reply to: Anonymous

Yes, Acad ObjectARX .NET API can only run inside Acad, the the form of DLL.
Period. If you want to use your stand-alone application to control Acad to
do something (automate Acad) you need to use Acad's COM API. Typically, that
is easier done in VB. Even you use VB.NET or C#, you still do it in the way
you do in VB.


wrote in message news:5665379@discussion.autodesk.com...
That mean I cannot run nothing outside AutoCAD?
Message 6 of 7
Anonymous
in reply to: Anonymous

thank you.

Where Can I found documantation about the COM API?

Thank you very very much
Message 7 of 7
Anonymous
in reply to: Anonymous

The help menu is loaded with examples and documentation...
wrote in message news:5665463@discussion.autodesk.com...
thank you.

Where Can I found documantation about the COM API?

Thank you very very much

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost