.NET

Reply
Mentor
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 1 of 8 (466 Views)
Accepted Solution

DWG to Image

466 Views, 7 Replies
03-01-2013 01:02 AM

Hello Everybody,

 

I have a basic question, i am trying to convert an autocad file to image, preferably an bmp, ti, png....etc.

 

Any body know how to achieve this objective since most of project parts are completed, am stuck up with this issue.

 

 

rgds

amit

Have you ever tried "Export" command in AutoCAD? If you had, you'd have known, PDF cannot be created with "EXPORT" command.

 

Also, the AcadDocument.Export() method does not export all the types of file the "Export" command does. If you have installed VBA, you can find this in VBA Help about what file type the Export() method can export:

 

<quote>

 

Extension

String; input-only This string should contain three characters specifying the type of file to export the drawing into. Case is not important. Use one of the following extensions: .wmf, .sat, .eps, .dsf, or .bmp.

 

</quote>

 

So, if you need to get PDF, you need to do plotting (to plot to DWG To PDF.pc3 or other PDF plotting device) instead of exporting.

Moderator
Alexander.Rivilis
Posts: 1,432
Registered: ‎04-09-2008
Message 2 of 8 (446 Views)

Re: DWG to Image

03-01-2013 02:24 AM in reply to: amitk_189

There are two methods:

1. Plot dwg to image format with AutoCAD Plot API.

2. Using ActiveX AutoCAD Model method Export

Both of them was using more than once in this board. Let use search.


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

Mentor
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 3 of 8 (432 Views)

Re: DWG to Image

03-01-2013 07:16 AM in reply to: amitk_189

Hello Alexander.Rivilis,

 

Thanks for reply, i will work on them, but i am supposed to use COM objects not inside AutoCAD. Any ideas??

 

 

Rgds

Amit

 

Moderator
Alexander.Rivilis
Posts: 1,432
Registered: ‎04-09-2008
Message 4 of 8 (422 Views)

Re: DWG to Image

03-01-2013 12:31 PM in reply to: amitk_189

Do I understand correctly that you're going to work with AutoCAD from an external exe-file through ActiveX interface? If so you can use AcadDocument.Export as well as AcadDocument.Plot.PlotToXXX methods.


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

Mentor
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 5 of 8 (396 Views)

Re: DWG to Image

03-02-2013 09:06 PM in reply to: amitk_189

Hello Alexander.Rivilis,

 

Thanks for Reply, yes Alexander you are right i am trying to do the same thing. Now i will work on the suggestions given by you. I will get back after some time with results

 

 

Regards

Amit

Mentor
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 6 of 8 (384 Views)

Re: DWG to Image

03-03-2013 06:45 AM in reply to: amitk_189

Hello Alexander,

 

I tried what you told to me. This is my code below

 


AcadApplication acadapp = new AcadApplication();
acadapp.Visible = false;
acadapp.Documents.Open(@"D:\Project\Cad Drawings\SHOP\PH#01\05-206.dwg");

AcadDocument acadDoc = acadapp.ActiveDocument; 

AcadSelectionSet sset = default(AcadSelectionSet);
sset = acadDoc.PickfirstSelectionSet;

acadDoc.Export(@"e:\exportFile", "pdf", sset);

 

But every time i get Invalid Argument error at the export step. Any ideas

 

 

Best Regards

Amit 

 

 

*Expert Elite*
norman.yuan
Posts: 1,017
Registered: ‎04-27-2009
Message 7 of 8 (378 Views)

Re: DWG to Image

03-03-2013 07:18 AM in reply to: amitk_189

Have you ever tried "Export" command in AutoCAD? If you had, you'd have known, PDF cannot be created with "EXPORT" command.

 

Also, the AcadDocument.Export() method does not export all the types of file the "Export" command does. If you have installed VBA, you can find this in VBA Help about what file type the Export() method can export:

 

<quote>

 

Extension

String; input-only This string should contain three characters specifying the type of file to export the drawing into. Case is not important. Use one of the following extensions: .wmf, .sat, .eps, .dsf, or .bmp.

 

</quote>

 

So, if you need to get PDF, you need to do plotting (to plot to DWG To PDF.pc3 or other PDF plotting device) instead of exporting.

Mentor
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 8 of 8 (366 Views)

Re: DWG to Image

03-03-2013 08:34 PM in reply to: amitk_189

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.