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

AutoCAD dwg into image format

8 REPLIES 8
Reply
Message 1 of 9
DiogoSantos
849 Views, 8 Replies

AutoCAD dwg into image format

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

8 REPLIES 8
Message 2 of 9
Artvegas
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...
Message 3 of 9
hgasty1001
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

Message 4 of 9
DiogoSantos
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

Message 5 of 9
Artvegas
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.

Message 6 of 9
DiogoSantos
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

Message 7 of 9
Artvegas
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

Message 8 of 9
DiogoSantos
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

Message 9 of 9
jmurua
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

 

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