VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export dwg to jpg/png

1 REPLY 1
Reply
Message 1 of 2
Anonymous
2307 Views, 1 Reply

Export dwg to jpg/png

Hi all,

 

I'm new to autocad and not familiar with autocad object model (but I have done a lot of vba for other drawing programs).

I need to export an entire dwg file to small tiles (each a png file, so I can later on overlay on google map). 

 

Logically, I need to:

1. programmatically zoom to a small bounding box.

2. programmatically cut and export each to a png.

 

These steps need to repeat for each resolution level (matching googles' zoom level).

 

Could anyone shed some light on this, thanks a lot.

 

Jay

 

 

Tags (1)
1 REPLY 1
Message 2 of 2
norman.yuan
in reply to: Anonymous

With AcadDocument.Export() method, you can export drawing visually into a few different formats of image file, including *.wmf and *.bmp, which may be suitable for your needs.

 

You would do:

 

1. determine the entities in drawing to be exported (modelspace or one of the layout, everything in the model/paperspace, or only selected ones);

2. create a selectionSet and add all the target entities into the selectionset

2. zoom to a proper view (zoom to all/extents/window)

3. call AcadDocument.Export(), supplying an image file name, file extension (wmf, or bmp) and the selectionset

4. You may want to write some code to do the image file format conversion (from wmf/bmp to jpg/png) after the exporting wmf/bmp.

Norman Yuan

Drive CAD With Code

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost