• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Distinguished Contributor
    amitk_189
    Posts: 169
    Registered: ‎12-15-2011
    Accepted Solution

    DWG to Image

    237 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

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,168
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Distinguished Contributor
    amitk_189
    Posts: 169
    Registered: ‎12-15-2011

    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

     

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,168
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Distinguished Contributor
    amitk_189
    Posts: 169
    Registered: ‎12-15-2011

    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

    Please use plain text.
    Distinguished Contributor
    amitk_189
    Posts: 169
    Registered: ‎12-15-2011

    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 

     

     

    Please use plain text.
    *Expert Elite*
    Posts: 681
    Registered: ‎04-27-2009

    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.

    Please use plain text.
    Distinguished Contributor
    amitk_189
    Posts: 169
    Registered: ‎12-15-2011

    Re: DWG to Image

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

    Please use plain text.