From 04feea80b10d12c5f355a2ce347b9f8fafc77a01 Mon Sep 17 00:00:00 2001 From: jriegel Date: Sun, 15 Jan 2012 12:57:06 +0100 Subject: [PATCH] Starting DocTool for FreeCAD documents --- src/Mod/Assembly/FCDocTool.py | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/Mod/Assembly/FCDocTool.py diff --git a/src/Mod/Assembly/FCDocTool.py b/src/Mod/Assembly/FCDocTool.py new file mode 100644 index 000000000..02951285c --- /dev/null +++ b/src/Mod/Assembly/FCDocTool.py @@ -0,0 +1,37 @@ +#! python +# -*- coding: utf-8 -*- +# (c) 2007 Juergen Riegel LGPL + +import zipfile + +class Document: + """ Document representation """ + def __init__(self,DocFile): + self.FileName = DocFile + print "Parsing: ",DocFile + self.ZFile = zipfile.ZipFile(DocFile,'r') + DStr = self.ZFile.read('Document.xml') + print DStr + + def fileInfo(self): + ret = '' + for i in self.ZFile.infolist(): + i += i.filename + i += '\n' + return ret + + +if __name__ == "__main__": + from optparse import OptionParser + + parser = OptionParser() + parser.add_option("-f", "--file", dest="filename", + help="write report to FILE", metavar="FILE") + parser.add_option("-l", "--list", + action="store_false", dest="verbose", default=True, + help="don't print status messages to stdout") + + (options, args) = parser.parse_args() + print (options,args) + d = Document(args[0]) +