• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

How to save dxf file with embedded thumbnail image?

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 3 Posters 2.9k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    liquid98
    last edited by 29 Nov 2012, 18:16

    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

    Things that flourish fall into decay. This is not-Tao, And what is not-Tao soon ends ~ Lao tse

    1 Reply Last reply Reply Quote 0
    • L Offline
      liquid98
      last edited by 30 Dec 2012, 20:36

      huh ?? Nobody?

      Things that flourish fall into decay. This is not-Tao, And what is not-Tao soon ends ~ Lao tse

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 30 Dec 2012, 21:34

        @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.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dan Rathbun
          last edited by 30 Dec 2012, 21:38

          @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.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • T Offline
            TIG Moderator
            last edited by 30 Dec 2012, 21:42

            ... 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...

            TIG

            1 Reply Last reply Reply Quote 0
            • L Offline
              liquid98
              last edited by 31 Dec 2012, 11:51

              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

              Things that flourish fall into decay. This is not-Tao, And what is not-Tao soon ends ~ Lao tse

              1 Reply Last reply Reply Quote 0
              • T Offline
                TIG Moderator
                last edited by 31 Dec 2012, 12:34

                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...

                TIG

                1 Reply Last reply Reply Quote 0
                • L Offline
                  liquid98
                  last edited by 31 Dec 2012, 14:26

                  It WILL be difficult, but I'll try next year... ☀ ☀

                  Things that flourish fall into decay. This is not-Tao, And what is not-Tao soon ends ~ Lao tse

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    Dan Rathbun
                    last edited by 31 Dec 2012, 16:47

                    Could be a job for ImageMajik ??

                    Embedding encoded thumbnails INTO the file, will bloat the filesize.

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement