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

Open DWG file from .NET

14 REPLIES 14
Reply
Message 1 of 15
Anonymous
1790 Views, 14 Replies

Open DWG file from .NET

Hello!

I need to open a DWG file from .NET (c# or VB), so i can access to all objects and entities that are drawed there. Does anyone know how can i do it, or point me to where i can learn it.

Thx in advance!
Regards
António Rodrigues
14 REPLIES 14
Message 2 of 15
Anonymous
in reply to: Anonymous

Autodesk.Autocad.Databaseservices.Database db = new Autodesk.Autocad.Databaseservices.Database (false, true);
db.ReadDwgFile(dwgFile, FileShare.Read, true, null);

hth
Jai
Message 3 of 15
Anonymous
in reply to: Anonymous

It really depends on from "what type" .NET application the OP meant: COM
Automation or ObjectARX, which your answer applies.

wrote in message news:5454723@discussion.autodesk.com...
Autodesk.Autocad.Databaseservices.Database db = new
Autodesk.Autocad.Databaseservices.Database (false, true);
db.ReadDwgFile(dwgFile, FileShare.Read, true, null);

hth
Jai
Message 4 of 15
Anonymous
in reply to: Anonymous

And of course none of them can be a stand-alone, but needs to be run from
inside autocad.

/Mats


"Norman Yuan" wrote in message
news:5454822@discussion.autodesk.com...
It really depends on from "what type" .NET application the OP meant: COM
Automation or ObjectARX, which your answer applies.

wrote in message news:5454723@discussion.autodesk.com...
Autodesk.Autocad.Databaseservices.Database db = new
Autodesk.Autocad.Databaseservices.Database (false, true);
db.ReadDwgFile(dwgFile, FileShare.Read, true, null);

hth
Jai
Message 5 of 15
Anonymous
in reply to: Anonymous

First i'd like to thank for your quick answers.

Does this mean that cannot open the DWG only from .NET, i always have to open AutoCAD. I'm doing a school work where i need to identify some objects in a draw and then perform some calculations with their properties (width, etc.) so i think i don't need to have AutoCAD running, just have to get all the objects that are part of the draw.
Message 6 of 15
Anonymous
in reply to: Anonymous

All this is AutoCAD-applications. I.e. loaded and ran from whitin AutoCAD.

There's an option called RealDwg where you create your own stand-alone host
application.
That costs; so i guess that's not an options for school work.

/Matt



wrote in message news:5455556@discussion.autodesk.com...
First i'd like to thank for your quick answers.

Does this mean that cannot open the DWG only from .NET, i always have to
open AutoCAD. I'm doing a school work where i need to identify some objects
in a draw and then perform some calculations with their properties (width,
etc.) so i think i don't need to have AutoCAD running, just have to get all
the objects that are part of the draw.
Message 7 of 15
Anonymous
in reply to: Anonymous

You can use the AutoCAD ActiveX Automation API out-of-process; AutoCAD must
still be installed on the machine.

This newsgroup is about using the AutoCAD .NET API for running
"applications" inside of AutoCAD.

Dan

wrote in message news:5455556@discussion.autodesk.com...
First i'd like to thank for your quick answers.

Does this mean that cannot open the DWG only from .NET, i always have to
open AutoCAD. I'm doing a school work where i need to identify some objects
in a draw and then perform some calculations with their properties (width,
etc.) so i think i don't need to have AutoCAD running, just have to get all
the objects that are part of the draw.
Message 8 of 15
Anonymous
in reply to: Anonymous

Do you mean that do not need to be started, just installed?

/Matt


"J. Daniel Smith" wrote in message
news:5455746@discussion.autodesk.com...
You can use the AutoCAD ActiveX Automation API out-of-process; AutoCAD must
still be installed on the machine.

This newsgroup is about using the AutoCAD .NET API for running
"applications" inside of AutoCAD.

Dan

wrote in message news:5455556@discussion.autodesk.com...
First i'd like to thank for your quick answers.

Does this mean that cannot open the DWG only from .NET, i always have to
open AutoCAD. I'm doing a school work where i need to identify some objects
in a draw and then perform some calculations with their properties (width,
etc.) so i think i don't need to have AutoCAD running, just have to get all
the objects that are part of the draw.
Message 9 of 15
Anonymous
in reply to: Anonymous

> This newsgroup is about using the AutoCAD .NET API for running
"applications" inside of AutoCAD.


Where in the world did you come up with such a ridiculous statement? Isn't
the beauty of .NET the ability to work with unmanaged / managed code?

Davis
Message 10 of 15
Anonymous
in reply to: Anonymous

First, i'd like to thank for all your answers. I'm getting confused... I'm going to explain the problem i have to solve so maybe you can point me a way to do it 🙂

I have to identify all objects related to a hydraulic net in a draw, then perform calculations about water pressure in that net.

I thought i could create a project in .NET and then open a DWG file and extract all the info i need. Is this possible? Do you know a better way to do it? I'm not familiar with AutoCAD (i'm a programmer, C#, VB, ...).

Yours,
António Rodrigues
Message 11 of 15
NathTay
in reply to: Anonymous

The Visual Basic Customisation group is a more appropriate place for ActiveX Automation questions. This group was intended for the .NET API not just any .NET language usage.

Regards - Nathan
Message 12 of 15
NathTay
in reply to: Anonymous

If you would like to have a standalone application it will need to use the ActiveX API. I will still need to create an instance of AutoCAD though.

If you are happy to run the application from within AutoCAD then you can use the .NET API and create a dll that is loaded into AutoCAD.

Deecide which way you want to go & then ask more questions in the appropriate group.

Regards - Nathan
Message 13 of 15
Anonymous
in reply to: Anonymous

There's also the ability to use activeX just to execute AutoCAD and from then on use AutoCAD's NET API. Through a combination of activeX (for starting AutoCAD), AutoCAD's NET API and Remoting, you can build an application that is executed outside AutoCAD, starts AutoCAD, opens the dwg file, gets all the data needed, closes AutoCAD and then continues with its calculations.
For a way to implement this read the following page:
http://snippetsandmusings.blogspot.com/2005/12/net-remoting-and-autocad-managed.html
Message 14 of 15
Ed.Jobe
in reply to: Anonymous

I think what they are trying to tell you is that you can't just "open" the file as a stream and get what you want. You need to use your app to open the file in acad and do your query. The api will allow you to manipulate acad, not extract a file's content.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 15 of 15
Anonymous
in reply to: Anonymous

>Where in the world did you come up with such a ridiculous statement? Isn't
>the beauty of .NET the ability to work with unmanaged / managed code?

I assume he came up with it via knowledge of what he is doing. Where did
you come up with yours?

"CADJunkie" wrote in message
news:5456187@discussion.autodesk.com...
> This newsgroup is about using the AutoCAD .NET API for running
"applications" inside of AutoCAD.




Davis

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