Advertisement
Guest User

Compatibility

a guest
Jan 6th, 2020
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. print("Part-o-magic: loading Compatibility")
  2. import FreeCAD as App
  3.  
  4. def get_fc_revision_nr():
  5.     App.Console.PrintWarning(u"Detected FC version.\n"
  6.                                  "    {vers}\n".format(vers= App.Version()))
  7.     rev = int(App.Version()[2].split(" ")[0])
  8.     ver = int(App.Version()[1])
  9.     return ver, rev
  10.          
  11. def check_POM_compatible():
  12.     """Raises CompatibilityError if PoM is known to not run"""
  13.     try:
  14.         ver, rev = get_fc_revision_nr()
  15.        
  16.     except Exception as err:
  17.         App.Console.PrintWarning(u"PartOMagic failed to detect FC version number.\n"
  18.                                  "    {err}\n".format(err= str(err)))
  19.         #keep going, assume the version is good enough...
  20.         return
  21.        
  22.     if (ver < 18 & rev < 9933):
  23.         raise CompatibilityError("Part-o-magic requires FreeCAD at least v0.17.9933. Yours appears to have a rev.{rev}, which is less.".format(rev= rev))
  24.    
  25. def scoped_links_are_supported():
  26.     try:
  27.         return get_fc_revision_nr() >= 12027
  28.     except Exception as err:
  29.         return True #assume good
  30.  
  31. class CompatibilityError(RuntimeError):
  32.     pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement