How to save dxf file with embedded thumbnail image?
-
Hello fellow nerds and nerdettes,
I'm interested in expanding SU's capability of exporting dxf/dwg files.
Along which lines should I think in order to generate such a file, including
an embedded image (for previewing purposes in windows explorer ), just like SU's native 'skp' formats?Best regards,
Liquid
-
huh ?? Nobody?
-
@liquid98 said:
Along which lines should I think in order to generate DXF, including
an embedded image (for previewing purposes in windows explorer ), just like SU's native 'skp' formats?IMHO, you cannot embed a thumbnail image in a plain text file (which is what DXF is.)
Windows has an standard icon it uses for DXF files (looks like a sheet of paper with the letters 'DXF' at the bottom, and two exchange arrows at the top of it.)
If you did embed an image, say base64 encoded, it might cause CAD applications to choke on the file when they try to parse it.
DWG files are binary files, so they can have a thumbnail in them, or Windows can be extended with a handler that can generate the thumbnails. But this is something separate from SketchUp and even AutoCAD. There is likely already something available on the web to extend Windows thumbnail capability for DWG files.
-
@liquid98 said:
I'm interested in expanding SU's capability of exporting dxf/dwg files.
Along which lines should I think in order to generate such a file, ...Well the Pro edition already does this.
If you must... then you will need to get a copy of the DXF specification, and learn how to write out text files in Ruby.
For the DWG binary format, you will likely need a DLL library, (which may cost money for a license.) See what AutoDesk and IMSI have available.
-
... and of course there are already several free scripts to export from Free as DXF - albeit somewhat limited in their scope... So perhaps use those as a basis and make a DXF exporter that's better than the Pro version... fame awaits...
-
Thanx guys,
I use a thumbnail viewer (explorer extension) to preview skp files in windows explorer.
One can write a plugin for the viewer to expand its functionality for different filetypes (like dwg and dxf).I already found the dxf-file-specs, it says something about THUMBNAILIMAGE section. But I can't get hold of a dxf file with such a keyword.. (probably because it's impossible
as Dan explains.)@TIG Please: no fame for me!!!!
At this moment its to complicated to write for me. But maybe in the future.
What functionality would you expect, better than the PRO version?Best wishes for 2013!
Liquid
-
From ACAD r2000 you can add a thumbnail into the DXF file's code using the
THUMBNAILIMAGE Section Group Codes 90 The number of bytes in the image (and its subsequent binary chunk records) 310 Preview image data (multiple lines: max 256 characters per line)
See http://www.autodesk.com/techpubs/autocad/acad2000/dxf/index.htm
and http://images.autodesk.com/adsk/files/acad_dxf0.pdf [pp247-248]Structuring this data is not going to be easy
There are simple ways to get the SKP's thumbnail:
model = Sketchup.active_model thumb = model.save_thumbnail("path/to/temp_folder/"+model.title+".bmp")
But thereafter extracting the data from it and writing it into a usable format in the DXF's text is the difficult part... -
It WILL be difficult, but I'll try next year...
-
Could be a job for ImageMajik ??
Embedding encoded thumbnails INTO the file, will bloat the filesize.
Advertisement