<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

      <title>Comments on: How do I convert a ZGL file to XGL?</title>
      <link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL/</link>
      <description>Comments on Ask MetaFilter post How do I convert a ZGL file to XGL?</description>
	  	  <pubDate>Wed, 12 Jul 2006 11:34:38 -0800</pubDate>
      <lastBuildDate>Wed, 12 Jul 2006 11:34:38 -0800</lastBuildDate>
      <language>en-us</language>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <ttl>60</ttl>

<item>
  	<title>Question: How do I convert a ZGL file to XGL?</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL</link>	
  	<description>How do I convert a .ZGL (compressed binary) file to a .XGL (uncompressed ASCII) file?</description>
  	<guid isPermaLink="false">post:ask.metafilter.com,2008:site.42014</guid>
  	<pubDate>Wed, 12 Jul 2006 11:27:48 -0800</pubDate>
  	<dc:creator>Java_Man</dc:creator>
	
	<category>3D</category>
	
	<category>CAD</category>
	
	<category>conversion</category>
	
</item>
<item>
  	<title>By: majick</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#645981</link>	
  	<description>&lt;a href=&quot;http://www.zlib.net/&quot;&gt;Uncompress it.&lt;/a&gt;</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-645981</guid>
  	<pubDate>Wed, 12 Jul 2006 11:34:38 -0800</pubDate>
  	<dc:creator>majick</dc:creator>
</item>
<item>
  	<title>By: Java_Man</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646043</link>	
  	<description>Unfortunately, the decompression algorithm has to specifically account for the compression algorithm used: are you sure that zlib can uncompress this type of file?</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646043</guid>
  	<pubDate>Wed, 12 Jul 2006 12:13:52 -0800</pubDate>
  	<dc:creator>Java_Man</dc:creator>
</item>
<item>
  	<title>By: devilsbrigade</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646053</link>	
  	<description>&lt;em&gt;Compress output file (to ZGL file)&lt;br&gt;
&lt;br&gt;
    If this option is enabled (checkmarked) then the final ASCII file will be compressed with ZLIB to create a .zgl compressed file. This will make the file much smaller in size. &lt;br&gt;
&lt;/em&gt;&lt;br&gt;
&lt;a href=&quot;http://www.okino.com/conv/exp_xgl.htm&quot;&gt;link&lt;br&gt;
&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
anyway, any time you see a compressed extension with .z, or .gz, you can be fairly sure its either zip or gzip compression. unix &apos;file&apos; should also tell you the compression format.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646053</guid>
  	<pubDate>Wed, 12 Jul 2006 12:20:01 -0800</pubDate>
  	<dc:creator>devilsbrigade</dc:creator>
</item>
<item>
  	<title>By: Java_Man</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646225</link>	
  	<description>I downloaded zlib, but it appears that zlib is only a library. So I tried decompressing the file with gzip (as it uses zlib as its underlying algorithm), but that didn&apos;t work. (It didn&apos;t like the file suffix: and if you change the suffix to &apos;gz&apos;, it complains that it&apos;s not in the right format.) Then I tried using the example code (minigzip) that ships with the zlib source to decompress it, but that does not work either. Is there any binary that will use the zlib library off the shelf? There is code inside the open source XGL Viewer that decompresses ZGL files, but I was hoping to not have to try to tease it out of there. Lastly, the &apos;file&apos; command shows the .zgl files as &apos;data&apos; (on Fedora Core 5). Thanks for the tip offs so far!</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646225</guid>
  	<pubDate>Wed, 12 Jul 2006 14:28:00 -0800</pubDate>
  	<dc:creator>Java_Man</dc:creator>
</item>
<item>
  	<title>By: devilsbrigade</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646297</link>	
  	<description>Use &apos;unzip myfile.zgl&apos;&lt;br&gt;
&lt;br&gt;
Works on FreeBSD, at least.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646297</guid>
  	<pubDate>Wed, 12 Jul 2006 15:46:23 -0800</pubDate>
  	<dc:creator>devilsbrigade</dc:creator>
</item>
<item>
  	<title>By: polyglot</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646488</link>	
  	<description>gunzip -c &amp;lt; somefile.zgl &amp;gt; somefile.xgl&lt;br&gt;
&lt;br&gt;
That means the data comes in on stdin, gunzip will never see the filename and can&apos;t bitch about the extension.  And note that the angle brackets are redirections, not placeholders telling you to substitute &lt;em&gt;somefile.zgl&lt;/em&gt;... you really type in the &amp;lt; and &amp;gt;</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646488</guid>
  	<pubDate>Wed, 12 Jul 2006 18:59:36 -0800</pubDate>
  	<dc:creator>polyglot</dc:creator>
</item>
<item>
  	<title>By: flabdablet</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646496</link>	
  	<description>The two most common zlib-based compressed formats are &lt;a href=&quot;http://en.wikipedia.org/wiki/Gzip#File_format&quot;&gt;gzip format&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/ZIP_%28file_format%29&quot;&gt;zip format&lt;/a&gt;.  It&apos;s fairly likely that any file made using zlib will be in one of those formats, and of them, zip is the one you&apos;ll see most often disguised as something else.&lt;br&gt;
&lt;br&gt;
If you&apos;re using Windows, and you have a compressed file that you suspect might be a zip file in disguise: make a copy of it, change the file extension on the copy to .zip, and double-click it.&lt;br&gt;
&lt;br&gt;
In the unix family, &lt;a href=&quot;http://unixhelp.ed.ac.uk/CGI/man-cgi?gunzip+1&quot;&gt;gunzip or zcat&lt;/a&gt; will uncompress gzip files, and &lt;a href=&quot;http://unixhelp.ed.ac.uk/CGI/man-cgi?unzip+1&quot;&gt;unzip&lt;/a&gt; wil uncompress zip files.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646496</guid>
  	<pubDate>Wed, 12 Jul 2006 19:10:39 -0800</pubDate>
  	<dc:creator>flabdablet</dc:creator>
</item>
<item>
  	<title>By: flabdablet</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646575</link>	
  	<description>If none of this works for you, it may be the case that the contents of a .ZGL file are made by using zlib&apos;s deflate() function on the data that would otherwise go to straight out to the corresponding .XGL, omitting file format headers (possibly even omitting the internal zlib header and adler32 checksum, if the format is *really* braindead) in which case you&apos;ll probably need to code something up.&lt;br&gt;
&lt;br&gt;
I found a small C program &lt;a href=&quot;http://www.w3.org/config/deflate.c&quot;&gt;here&lt;/a&gt; that does this kind of raw zlib compression from stdin to stdout; seems to me that if you used that as a base and changed all the calls to deflate() and related functions to their inflate() equivalents and tweaked a little here and there, you&apos;d probably get a working raw decompressor.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646575</guid>
  	<pubDate>Wed, 12 Jul 2006 20:16:20 -0800</pubDate>
  	<dc:creator>flabdablet</dc:creator>
</item>
<item>
  	<title>By: baylink</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646611</link>	
  	<description>How come no one&apos;s asked him what the hell the files come out of?&lt;br&gt;
&lt;br&gt;
Hey, JavaMan?  What *is* a .ZGL file?</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646611</guid>
  	<pubDate>Wed, 12 Jul 2006 20:42:56 -0800</pubDate>
  	<dc:creator>baylink</dc:creator>
</item>
<item>
  	<title>By: flabdablet</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646718</link>	
  	<description>Yep.  Just downloaded xglviewer.zip and had a poke around in the import code, and all it seems to do with .zgl files is run them through inflate(); there&apos;s no header processing done.  IIRC inflate() will actually autodetect and skip gzip headers if present, so it&apos;s a total pain that the .zgl files you have apparently don&apos;t include gzip wrappers.  Designers who don&apos;t use standard formats to do standard jobs need a good kick up the arse.&lt;br&gt;
&lt;br&gt;
Fortunately there&apos;s a reasonably easy workaround.  If you whack a minimal gzip header onto the front of a bunch of raw zlib-compressed data and then pipe the result through zcat, you get uncompressed data out the other end of the pipe, with an easily-ignored complaint about an unexpected end-of-file when the gzip checksum trailer doesn&apos;t turn up as expected.&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Procedure for Windows command prompt&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;
Make the header file by using debug, as follows:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
debug&lt;br&gt;
e 100 1f 8b 08 00 00 00 00 00 00 ff&lt;br&gt;
n gzheader&lt;br&gt;
r cx&lt;br&gt;
0a&lt;br&gt;
w&lt;br&gt;
q&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
To uncompress .zgl files:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
copy /b gzheader+yourfile.zgl yourfile.xgl.gz&lt;br&gt;
zcat yourfile.xgl.gz &amp;gt;yourfile.xgl&lt;br&gt;
del yourfile.xgl.gz&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
A simple &lt;code&gt;gunzip yourfile.xgl.gz&lt;/code&gt; won&apos;t work, because gunzip will barf on the missing checksum trailer.&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Procedure for bash shell (unix family, or Cygwin under Windows)&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;
To make the header file:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
echo -ne &apos;\037\213\010\0\0\0\0\0\0\377&apos; &amp;gt;gzheader&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
To uncompress .zgl files:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
cat gzheader yourfile.zgl | zcat &amp;gt;yourfile.xgl&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
I don&apos;t have any .zgl files available for testing, so please let me know whether this works!</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646718</guid>
  	<pubDate>Wed, 12 Jul 2006 22:14:18 -0800</pubDate>
  	<dc:creator>flabdablet</dc:creator>
</item>
<item>
  	<title>By: flabdablet</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#646790</link>	
  	<description>Looking over assorted zlib specs again: if what I just told you to do doesn&apos;t work, there might be extra header stuff in the front of the .zgl file that will confuse zcat. If you mail me one of your files (address is in my profile) I&apos;d be happy to fiddle until I can uncompress it.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-646790</guid>
  	<pubDate>Thu, 13 Jul 2006 01:05:46 -0800</pubDate>
  	<dc:creator>flabdablet</dc:creator>
</item>
<item>
  	<title>By: Java_Man</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#647210</link>	
  	<description>Thanks, everyone for all of the responses! The ZGL files that I have been working with were exported from Solid Works. They are CAD files. More specifically, they are an export of the solid 3D CAD data into polygonal meshes, represented by OpenGL commands, wrapped in XML, and compressed with Zlib. &lt;br&gt;
&lt;br&gt;I tried the advice about adding the gzheader, but that did not work. Nor did any of the &apos;unzip&apos; or &apos;gunzip&apos; suggestions. The gzheader attempt resulted in this error: &amp;quot;zcat: stdin: invalid compressed data--format violated.&amp;quot; &lt;br&gt;
&lt;br&gt;However, I did have success decompressing the files! &lt;br&gt;
&lt;br&gt;I followed flabdablet&apos;s advice about using the small C &lt;a href=&quot;http://www.w3.org/config/deflate.c&quot;&gt;program &lt;/a&gt;. I had to change a few lines of code. Everywhere where there was a call to &apos;deflate&apos; something, I swapped it with &apos;inflate&apos;. The only catch was the line: &amp;quot;deflateInit(&amp;amp;z, compression_rate);&amp;quot; &lt;br&gt;
That needs to be changed to &amp;quot;inflateInit(&amp;amp;z);&amp;quot; as inflateInit does not take a compression rate parameter. Also, be sure to compile it as C++ code (instead of C code) and add: &amp;quot;#include &lt;string .h&gt;&amp;quot;.&lt;br&gt;
&lt;br&gt;Thanks again for the help!&lt;/string&gt;</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-647210</guid>
  	<pubDate>Thu, 13 Jul 2006 09:40:02 -0800</pubDate>
  	<dc:creator>Java_Man</dc:creator>
</item>
<item>
  	<title>By: Java_Man</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#647223</link>	
  	<description>Oops. I forgot the character entity on that. You need to add the line: &amp;quot;#include  	&amp;lt;string.h&amp;gt;&amp;quot;&lt;br&gt;
&lt;br&gt;Thanks again.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-647223</guid>
  	<pubDate>Thu, 13 Jul 2006 09:44:29 -0800</pubDate>
  	<dc:creator>Java_Man</dc:creator>
</item>
<item>
  	<title>By: Java_Man</title>
  	<link>http://ask.metafilter.com/42014/How-do-I-convert-a-ZGL-file-to-XGL#647265</link>	
  	<description>Oh, one other thing, anywhere where something was set to the input_buffer or output_buffer (e.g. line 79), I had to explicitly cast to Bytef*. &lt;br&gt;
&lt;br&gt;E.g. &amp;quot;z.next_out = output_buffer;&amp;quot; --&amp;gt; &amp;quot;z.next_out = (Bytef*)output_buffer;&amp;quot;</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.42014-647265</guid>
  	<pubDate>Thu, 13 Jul 2006 10:09:39 -0800</pubDate>
  	<dc:creator>Java_Man</dc:creator>
</item>

    </channel>
</rss>
