Displaying DXF or DWG files...

lidds

Junior Contributor
Joined
Nov 9, 2004
Messages
210
I was wondering if anyone has had experience in displaying DXF or DWG files (file type produced by AutoCad - a design application) within vb.net. An example of code would be great

Cheers

Simon
 
It is fairly easy, Autocad provide a DWG viewer, I think it is called VoloView. If you install this and then in your application you can just launch a process which is just the DWG file name and your system should reckognise the file type an launch the viewer. I think they also have a DXF one. If you want to go the full hog, they provide sample C++ applications. Use the 1st method, it works.

They may also have a browser plug-in that you could use.
 
Problem...

The problem is that I am currently writing an application that I shall hopefully be marketing and to be honest I don't really want to get into the whole supplying third party software and license agreements etc.

Also you are charged to purchase voloview to open autocad 2004 drawings. At the moment voloview will open all version except 2004 (unless purchase upgrade), so again I'm back to the problem of relying on a company to have a dxf viewer or supplying third party software with mine.

I would prefer to be able to write my own vb.net dxf viewer, but as I have no idea of really where to start (hence the post), I was hoping for a bit of help.

Thanks in advance

Simon
 
You will need to write a parser to parse the DXF/DWG for layer, color,entity type, linetype, X,Y locations, size etc etc etc. I wrote a dedicated DXF reader a number of years ago (VB4!!!). It was designed just to read circles and it was a PAIN!!. Handling all possible entity types could be a real nightmare. Not to mention Autodesk tries to ensure each version cannot be read by another version (criminal as far as I'm concerned), so be prepared for a great deal of "version" maintenance.
 
Thanks..

Thanks for all of yours help, looked like I was in for a lot of programming, untill I came across an excellent piece of software called dxfReader produced by Kadmos. It's an activex component that allows you to add all functionality that is avaliable in AutoCad (obviously with code) and it only retails for 159 euros, bargain. Have only been using it for the past couple of days (trial version) but it does look very impressive for the money, so a definate must if you are ever trying to acheive the same.

Simon
 
Aren't you now tying yourself to Kadmos instead of Autocad. I would be wary of that. At least Autocad viewers will keep uptodate and are probably not too expensive.

There is another option, to convert the files to DWF format and then display them.
 
Not really, and also I am now needing to add additional graphics to the DXF file and DXFReader allows you to use all the same functionallity as AutoCad e.g. creating layers, lines, dimensions etc. DXFReader is also royalty free, but you did bring up a good point about cad versions so I will have to look into that.

Simon
 
Back
Top