.NET

Reply
Contributor
DiogoSantos
Posts: 17
Registered: ‎06-19-2012
Message 1 of 9 (295 Views)

AutoCAD dwg into image format

295 Views, 8 Replies
06-21-2012 04:17 AM

Hello,

 

I'm trying to "transform" an autocad drawing into an image format file, but I only can get the image that is in the main window, never the whole drawing. Anybody can help me how to get the whole drawing and convert it to an image format file.

 

Thanks and kind regards,

Diogo

Distinguished Contributor
Artvegas
Posts: 104
Registered: ‎04-21-2011
Message 2 of 9 (264 Views)

Re: AutoCAD dwg into image format

06-22-2012 10:51 PM in reply to: DiogoSantos
What image format are you interested in? Vector? Raster? How are you going about it? If you are talking about a raster image then maybe the ScreenShot plugin-of-the-month might have what you are looking for: http://through-the-interface.typepad.com/through_the_interface/2009/11/novembers-plugin-of-the-month...
Valued Mentor
gasty1001
Posts: 449
Registered: ‎04-11-2010
Message 3 of 9 (252 Views)

Re: AutoCAD dwg into image format

06-23-2012 03:54 PM in reply to: DiogoSantos

Hi,

 

You can plot the drawing to a raster file (jpg or png) using the publish to web (jpg/png) pc3.

 

Gaston Nunez

Contributor
DiogoSantos
Posts: 17
Registered: ‎06-19-2012
Message 4 of 9 (241 Views)

Re: AutoCAD dwg into image format

06-24-2012 09:29 AM in reply to: DiogoSantos

Hello,

 

Yes that is really what i want, but I want to do it programmatically. I want to raster the whole drawing to an image like jpeg or a png image. Do you have any ideas how can I accomplish that?

 

Thanks

Diogo

Distinguished Contributor
Artvegas
Posts: 104
Registered: ‎04-21-2011
Message 5 of 9 (236 Views)

Re: AutoCAD dwg into image format

06-24-2012 10:07 AM in reply to: DiogoSantos

I can see two options:

1. Programatically zoom-extents your drawing and take a screenshot as per the ScreenShot plugin; or

2. Programatically plot the drawing to an image format as suggested by Gaston.

 

I would go for option 2 as you will have full control over the resolution of the raster image produced.

 

To get you started, the following lists a bunch of posts for programatically plotting in AutoCAD:
http://through-the-interface.typepad.com/through_the_interface/plotting/

 

Searching these forums and I'm sure you'll find something that suits.

 

Hope this helps.

Contributor
DiogoSantos
Posts: 17
Registered: ‎06-19-2012
Message 6 of 9 (226 Views)

Re: AutoCAD dwg into image format

06-24-2012 01:45 PM in reply to: DiogoSantos

Hello,

 

First of all thanks for all the answers, I've been searching in that blog that you mentioned and it always creates a dwf file, what I want is a jpeg or a png file, I think maybe it has something to do with the configuration used like this:

 

psv.SetPlotConfigurationName(ps, "DWF6 ePlot.pc3", "ANSI_A_(8.50_x_11.00_Inches)");

 

Because when it calls the function to generate the output file:

 

pe.BeginDocument( pi, doc.Name, null, 1, true, "c:\\test-output");

 

This will create test-output.dwf file, maybe this has something to do with that option DWF6 ePlot.pc3

Is there any configuration for jpeg or png file?

 

Thanks,

Diogo

Distinguished Contributor
Artvegas
Posts: 104
Registered: ‎04-21-2011
Message 7 of 9 (216 Views)

Re: AutoCAD dwg into image format

06-24-2012 08:44 PM in reply to: DiogoSantos

Yes DWF6 ePlot.pc3 will plot to *.dwf. To see what other plot configurations are available on your system check the plot dialog in AutoCAD. For *.jpg try using PublishToWeb JPG.pc3 and for *,png try using PublishToWeb PNG.pc3.

 

Plot.jpg

Contributor
DiogoSantos
Posts: 17
Registered: ‎06-19-2012
Message 8 of 9 (204 Views)

Re: AutoCAD dwg into image format

06-25-2012 03:01 AM in reply to: DiogoSantos

Yes that was it, once I used

acPlSetVdr.SetPlotConfigurationName(acPlSet, "DWG to PDF.pc3", "ANSI_A_(8.50_x_11.00_Inches)");

 

It creates a pdf file.

Thanks a lot,

 

Diogo

New Member
jmurua
Posts: 1
Registered: ‎12-19-2011
Message 9 of 9 (197 Views)

Re: AutoCAD dwg into image format

06-25-2012 06:16 AM in reply to: DiogoSantos
   Public Shared Sub GenerarImagenExterna(ByVal archivoDWG As String, ByVal tamaino As Drawing.Size)
        Dim imagen As Drawing.Bitmap
        Dim acadDoc As Document
        Dim acadDocs As DocumentCollection
        acadDocs = Application.DocumentManager
        acadDoc = acadDocs.Open(archivoDWG, forReadOnly:=False)
        imagen = acadDoc.CapturePreviewImage(width:=CType(tamaino.Width, UInteger), height:=CType(tamaino.Height, UInteger))
        acadDoc.CloseAndDiscard()
        imagen.Save(IO.Path.ChangeExtension(archivoDWG, ".png"))
    End Sub

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community