Import from MS Project

Help
AnGus King
2009-01-16
2013-12-03
  • AnGus King

    AnGus King - 2009-01-16

    Hi

    I'm after a copy of the MS Project to FreeMind programs mentioned in Import and export to other applications (http://freemind.sourceforge.net/wiki/index.php/Import_and_export_to_other_applications#From_MS_Project) . These are MindMap.pm or mpp2mm.pl - the links just link back to this page

    Thanks

    AnGus

     
    • Ira L. Greenstein

      AnGus,

      Did you ever find the code to export MS Project files to FreeMind?

      Thank you,

      Ira

       
      • Daniel Polansky

        Daniel Polansky - 2009-07-17

        The three files that were referred to in the wiki -- Media:MindMap.pm, Media:mpp2mm.pl, Media:generateOrgChart.pl -- are not there, and as far as I can ascertain never have been uploaded. I have deleted the misleading section from the wiki.

        http://freemind.sourceforge.net/wiki/index.php/Import_and_export

        --Dan

         
        • AnGus King

          AnGus King - 2009-08-11

          Ira and Dan

          I might have a look at this if you're interested (someday so don't hold your breath). I could go for something simple to start with so do you have any thoughts on what you'd like?

          AnGus

           
        • AnGus King

          AnGus King - 2009-08-12

          Ira

          (Apologies for the tacky Python code, but I'm only a learner). The following Python routine is a first cut at creating a FreeMind map from an MS Project xml file (ie. need to save the MS Project file as xml rather than normal mpp). I don't know how to upload this into the FreeMind wiki but am happy to have it there - remembering this is "asis" with no waranty expressed or implied.

          Parameters are as described:

          -i <iput xml file>
          -o <output mm file> - defaults to same name as input file (but with .mm filetype)
          -a generate some Attributes. Theses are the same as the mm2mpp.xsl translater (ie. task duration, author and project start date)
          -c generate a flag (tick icon) for completed tasks

          This won't create the dependency arrows.

          Try it as a starter. Here's the code

          Kind regards

          AnGus

          #!/usr/bin/env python
          #

          """Create a FreeMind (.mm) mind map from a/an MS Project XML file.

          usage: mpp2mm -i <mppfile> -o <mmfile> -a -c
          Options and arguments:
          -a         : generate (some) Attributes
          -c         : generate icons for completed tasks
          -i mppfile : input MS Project xml file
          -o mmfile  : output FreeMind map (name defaults to input filename)

          Copyright (C) AnGus King, 2009
          This code is licensed under the GPLv2 or later.
          (http://www.gnu.org/copyleft/gpl.html)

          """

          __author__ = "ozsolarwind@yahoo.com.au (AnGus King)"
          __copyright__ = "Copyright (C) 2009 AnGus King"
          __license__ = "GPLv2 (http://www.gnu.org/copyleft/gpl.html)"
          __version__ = "1.0"

          import getopt
          import sys
          import xml.etree.ElementTree as ET

          class Mpp2Mm:
             
              def __init__(self):
                  self.mmn = [] # create an empty node tree
                  self.mmn.append("")
                  self.lst_lvl = 0 # last level is 0
                  self.do_attr = False # by default don't create Attributes
                  self.do_flag = False # by default don't flag completion       

              def open(self, infile):
                  """ Open the .xml file and create a tree """
                  self.tree = ET.parse(infile)
                  return self.tree

              def write(self, outfile, attr, flag):
                  """ Create the .mm file :-) """
                  self.do_attr = attr
                  self.do_flag = flag
                  root = self.tree.getroot()
          #       create the mindmap as version 8.1 (can easily change to 9.0)
          #       should probably be 9.0 if you're generating attribute tags
                  self.mm = ET.Element("map",version="0.8.1")
          #       process Task elements and fabricate hierarchy based upon OutlineLevel
                  for node in root:
                      if node.tag ==  "{http://schemas.microsoft.com/project}Name":
          #               print "Project:" , node.text
                          self.mmn[0] = ET.SubElement(self.mm, "node", text=node.text)
                      elif node.tag ==  "{http://schemas.microsoft.com/project}Author":
          #               print "Author:" , node.text
                          if self.do_attr:
                              self.mmn[0].append(ET.Element("attribute", \                         NAME="prj-Author", VALUE=node.text))
                      elif node.tag ==  "{http://schemas.microsoft.com/project}StartDate":
          #               print "StartDate:" , node.text
                          if self.do_attr:
                              self.mmn[0].append(ET.Element("attribute", \                          NAME="prj-StartDate", VALUE=node.text))   
                      else:
          #               the guts of it is the Tasks
                          if node.tag ==  "{http://schemas.microsoft.com/project}Tasks":
                              for nod in node:
                                  if nod.tag ==  "{http://schemas.microsoft.com/project}Task":
                                      if nod.findtext("{http://schemas.microsoft.com/project}UID") <> "0":   
          #                               print "UID:", nod.findtext("{http://schemas.microsoft.com/project}UID")
          #                               print "Name:", nod.findtext("{http://schemas.microsoft.com/project}Name")
          #                               print "Start:", nod.findtext("{http://schemas.microsoft.com/project}Start")
          #                               print "Finish:", nod.findtext("{http://schemas.microsoft.com/project}Finish")
          #                               print "WBS:", nod.findtext("{http://schemas.microsoft.com/project}WBS")
                                          lvl = nod.findtext("{http://schemas.microsoft.com/project}OutlineLevel")
                                          txt = nod.findtext("{http://schemas.microsoft.com/project}Name")
          #                               print "Level/Task:", lvl + " " + txt
                                          lvli = int(lvl)
                                          if lvli > self.lst_lvl:
                                              self.mmn.append("")
                                              self.lst_lvl = lvli
                                          self.mmn[lvli] = ET.SubElement(self.mmn[lvli-1], "node",text=txt)
                                          if self.do_attr:
                                              self.mmn[lvli].append(ET.Element("attribute", NAME="tsk-Duration", \                                         VALUE=nod.findtext("{http://schemas.microsoft.com/project}Duration")))
                                          if self.do_flag:   
                                              txt = nod.findtext("{http://schemas.microsoft.com/project}PercentComplete")
                                              if txt == "100":
                                                  self.mmn[lvli].append(ET.Element("icon", BUILTIN="button_ok"))
                  tree = ET.ElementTree(self.mm)
                  tree.write(outfile)
                  return

          def usage():
              print __doc__
              sys.exit(-1)

          def main():
              try:
                  opts , args = getopt.getopt(sys.argv[1:], "i:o:hac", \             ["help", "input=", "output="])
              except getopt.GetoptError, err:
                  # print help information and exit:
                  print str(err) # will print something like "option -x not recognized"
                  usage()
              input = None
              output = None
              attr = False
              complete = False
              for o, a in opts:
                  if o == "-a": # wants attributes printed
                      attr = True
                  elif o == "-c": # wants completion flags
                      complete = True   
                  elif o in ("-h", "--help"):
                      usage()
                  elif o in ("-i", "--input"):
                      input = a
                  elif o in ("-o", "--output"):
                      output = a
                  else:
                      assert False, "unhandled option"
              if input == None:
                  print "Input file required"
                  usage()
              if not input.endswith('.xml'):
                  print "Input file must end with '.xml'"
                  usage()
              if output == None:
                  output = input[:-3] + "mm"
              if not output.endswith('.mm'):
                  print "Output file must end with '.mm'"
                  usage() 
              mpp2mm = Mpp2Mm()
              tree = mpp2mm.open(input)
              mpp2mm.write(output,attr,complete)
              print output + " created."

          if __name__ == "__main__":
              main()

           
        • AnGus King

          AnGus King - 2009-08-14

          Dan and Ira

          I've posted these MS Project to FreeMind programs and a PyQT4 dialog into the Accessories page.

          I've also posted a FreeMind to MSProject XML file there as well. This was from the Help from many months ago.

          AnGus

           
          • Daniel Polansky

            Daniel Polansky - 2009-08-14

            Thank you AnGus. The best thing you can do I think with the code you have written is to post all the code and its documentation to the Conversions tracker. It is important that you attach an fitting license to the code or the documentation, such as GNU GPL V2+ or public domain: if you do, your code can be added to FreeMind distribution. Notice the "V2+" in GNU GPL V2+; the "+" is important -- it means that you license the code under GNU GPL version 2 *or later at your option*.

            The Conversions tracker:
            http://sourceforge.net/tracker/?group_id=7118&atid=964006

            --Dan

             
            • AnGus King

              AnGus King - 2009-09-02

              Dan

              I've added the suite of programs in the Tracker as 'MSProject2FreeMind and FreeMind2MSProject'. I've licensed as GPL2 those I feel I can (the two GUI programs are plagiarised from PyQt examples so not sure if there's enough originality in them).

              The MS Project to FreeMind tools (written in Python) will enable FreeMind maps to be created from MS Project normal (.mpp) and XML (.xml) files. It will create arrows for Predecessor links and flag completed tasks with flags (ticks). The maps created can then be exported to XML (via the XSLT tool) and reloaded into MS Project.

              In theory these tools should enable one to move both ways between MS Project and FreeMind.

              I might add support for CSV files. It would be nice to add Resourcing but I'll probably only look a that if I have a requirement.

              Happy for any feedback (I need to do more testing)

              Kind Regards

              AnGus

               
    • AnGus King

      AnGus King - 2009-08-13

      Ira

      I've loaded this version (as pp2mm.1.0.py) and a new version in the wiki http://freemind.sourceforge.net/wiki/index.php/Import_and_export

      The new version (mpp2mm.py) will also handle .mpp files (win32com.client).

      Kind regards

      AnGus

       
  • MOHAMED MESHREF

    MOHAMED MESHREF - 2013-12-03

    I have tried to import an mpp file to freemind using mpp2mm.py file, but I got the here below error. Is there anyone that may help me?

    PS C:\mystaff> python27 'c:\mystaff\mpp2mm.py' -i "c:\mystaff\07-EA123_.mpp" -c -a
    Traceback (most recent call last):
    File "c:\mystaff\mpp2mm.py", line 37, in <module>
    from mppxml2mm import Mppxml2Mm
    ImportError: No module named mppxml2mm
    PS C:\mystaff>

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks