8

Creating a ruby on rails site that uses RMagick to create thumbnails for many types of images. RMagick cannot read dwg files however.

I've tried a few things, looked into the Java library JDWGLib, which would probably allow me to write a converter, but it would be a total from the ground up solution, where I just need a thumbnail.

Also considered using a viewer program to open the file in a remote X session and do a screen capture, however I'm not sure how I could ever guarantee that the viewer had completed opening when I took the screenshot.

I'm not concerned with being able to manipulate the file other than to create the thumbnail. It is going to be used for commercial purposes, so any libraries used need to be compatible.

marcgg
  • 65,020
  • 52
  • 178
  • 231
Kyle
  • 1,662
  • 2
  • 21
  • 38
  • Oh, the joys of proprietary file formats. It looks like they've done a very "good" job limiting programs which can read dwgs - there are some free as in beer viewers, but that's about it, since you have to purchase a license to do anything at all. I don't think you'll get anything much better than egarcia's answer. – Cascabel Apr 03 '10 at 16:46
  • That's what I was concerned about. I'm gonna see if anyone has an idea about the x-session method. – Kyle Apr 05 '10 at 10:50
  • Did you came up with a solution? I need to create thumbs from DWG files. – carpamon Mar 17 '12 at 20:48
  • No sorry, I never did find a way to do this. There were some older formats that allowed me to use imagemagick at the command line to generate a thumbnail, however modern formats of DWG are proprietary and not open sourced. – Kyle Mar 19 '12 at 19:22

2 Answers2

3

cad2svg is a simple Linux command-line utility that automatically converts AutoCAD files (both dwg and dxf) to SVG.

the link

Felix
  • 3,058
  • 6
  • 43
  • 53
1

I could not find any command-line-able tool for making thumbnails, on either windows or linux.

I guess you could download the DWGdirect lib (C++) wich allows the exportation of a DWG to a bitmap... but this requires purchasing a membership license on the """Open""" Design Aliance.

I would recommend adding an additional file input on your form that says "thumbnail". And let the users provide the screenshots.

kikito
  • 51,734
  • 32
  • 149
  • 189