开发者

Ideas for rendering 2d autocad drawings in a browser

I'm working on a .net mvc web application. A core piece of functionality is a requirement to take a DWG (AutoCAD) file, and render it on the web application, in such a way that the user can zoom in/out and move about the drawing. I also need to add overlays to the drawing to represent various things.

I'm trying to work out the best way to do this. There are various .net CAD libraries out there but the best you can get browser-based are tools that will convert the file to an image on the server and render it on the page.

My current idea is to convert the dwg to an image, use something like google maptiler to chop up the image at various zoom levels, and then use something like openlayers.org to present this to the user.

Are there other/eas开发者_StackOverflowier/better solutions?


You could convert the DWG to a GIS format like a geo-referenced image (e.g. geoTIFF), and then use a map server to serve the image to OpenLayers or to Google Maps.

Essentially the map server chops up the tiles for you on-the-fly as they are requested. This means you can support arbitrary zooming and panning.

This is the "purest" way of doing things with OpenLayers - and it's a lot easier than it might sound. MapServer & GeoServer are good free open source map servers, this is vanilla stuff for them. In the past I used to chop up images into Google Maps tiles myself, but I'm not going back now.


You may want to look Autodesk's Freewheel application, which allows you to render 2D and 3D files on the server.

Another possibility would be to convert the relevant parts of the drawing file to your own format, and render them with Javascript. You can use a library like Dojo to facilitate this. This approach is more work, but you will get cross-browser compatibility and more control over the display.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜