Flex/Flash AutoCAD DWG/DXF Viewer


I put this together as a proof of concept. It can render DWG files up to, and including, AutoCAD 2009. DXF files are also supported.

The demo is limited to a file upload size of 250kb.

Flash’s rendering capability puts an upper limit on the complexity of the drawing. A DWG file close to the 250kb limit will likely render slowly and cause response to be sluggish. The rendering engine is fully capable of rendering large files provided the client computer can support it.

I temporarily embedded Arial as the default font. You can see on a few of the holes in the initial drawing that the diameter symbol has been replaced by another character. I need to track down a proper CAD font to use in the viewer.

A number of the CAD files I looked at required fractional font sizes. I solved this by setting font size using Math.floor and setting scaleX/scaleY to account for the remainder. I am planning to port this feature over to the SVG Viewer as time allows.

8 thoughts on “Flex/Flash AutoCAD DWG/DXF Viewer

  1. james

    Hi Pedro,

    I created a custom C++ program using a copy opendwg.org’s DWGdirect library.
    Use of the library requires a license from the Open Design Alliance.


  2. G Kannappan

    I am interested to know if autocad viewer is available in action script form as library for usage.

    Thanks & Regards
    G Kannappan

  3. james

    Hey G Kannappan,

    I do not have a pure ActionScript solution for rendering AutoCAD files.
    Most of the heavy lifting is done server side via a C++ program.
    The program uses a third party, proprietary library.

    My current license for that library does not allow me to distribute the AutoCAD parser.
    If you are looking to use it in a project I could look into getting a commercial license.


  4. Pedro Sacramento

    I believe that using qcad’s vec2Web (http://www.qcad.org/vec2web.html) could give us a good opensource sollution.

    Vec2web doesn’t work with DWG nor with newest DXF files, but it’s able to convert older DXF files to XML, and is completly opensource.

    I’m working hard make an opensource online SVG editor for CAD drawing (colaboraonline.wordpress.com – my idea, brazilian portuguese).

    I’ve found an online Lisp interpreter, but I don’t know if it’s opensource (http://www.solve-et-coagula.com/?p=8). Adding Lisp support would be great too!

    Anybody knows any simple SVG drawing editor using your as3 svg library that could be integrated with a Lisp interpreter for CAD drawing?

    thanks in advance

  5. Andy Jones

    Hi James,
    I realise this is an old post but I have a similar situation I need to solve.

    I’m creating a flash app which needs to generate a dxf file, or at least generate some parameters for use in CAD software. Do you have any tips on how I might do this?


  6. AUTOCAD Viewer

    Great Post…..

    I found your site on stumbleupon and read a few of your other posts. Keep up the good work. I just added your RSS feed to my Google News Reader. Looking forward to reading more from you down the road!

  7. Sandra

    Hi James,
    I have a similar situation as Andy.

    How do you accessing the dwg file. Do you have any tips on how I might do this?


Comments are closed.