Beispiel #1
0
 def __exit__(self, exception, exception_value, traceback):
     if exception:
         self.transaction.RollBack()
         logger.error('Error in Transaction Context: has rolled back.')
         logger.error('{}:{}'.format(exception, exception_value))
         raise exception(exception_value, '')
     else:
         try:
             self.transaction.Commit()
         except Exception as errmsg:
             self.transaction.RollBack()
             logger.error('Error in Transaction Commit: has rolled back.')
             logger.error('Error: {}'.format(errmsg))
             raise
Beispiel #2
0
 def __exit__(self, exception, exception_value, traceback):
     if exception:
         self.transaction_group.RollBack()
         logger.error('Error in TransactionGroup Context: has rolled back.')
         logger.error('{}:{}'.format(exception, exception_value))
     else:
         try:
             if self.assimilate:
                 self.transaction_group.Assimilate()
             else:
                 self.transaction_group.Commit()
         except Exception as errmsg:
             self.transaction_group.RollBack()
             logger.error('Error in TransactionGroup Commit: has rolled back.')
             logger.error('Error: {}'.format(errmsg))
 def __exit__(self, exception, exception_msg, tb):
     if exception:
         self.transaction.RollBack()
         logger.error('Error in Transaction Context: has rolled back.')
         # traceback.print_tb(tb)
         # raise exception # Let exception through
     else:
         try:
             self.transaction.Commit()
         except Exception as exc:
             self.transaction.RollBack()
             logger.error('Error in Transaction Commit: has rolled back.')
             logger.error(exc)
             raise
Beispiel #4
0
 def __exit__(self, exception, exception_msg, tb):
     if exception:
         self.transaction_group.RollBack()
         logger.error('Error in TransactionGroup Context: has rolled back.')
     else:
         try:
             if self.assimilate:
                 self.transaction_group.Assimilate()
             else:
                 self.transaction_group.Commit()
         except Exception as exc:
             self.transaction_group.RollBack()
             logger.error('Error in TransactionGroup Commit: has rolled back.')
             logger.error(exc)
             raise exc
Beispiel #5
0
from rpw.utils.logger import logger

try:
    #  This is a workaround to fix Sphinx's autodoc
    import clr
    clr.AddReference('RevitAPI')
    clr.AddReference('RevitAPIUI')
    clr.AddReference('System')

    from Autodesk.Revit import DB
    from Autodesk.Revit import UI
    from System.Collections.Generic import List
    from System import Enum

except Exception as errmsg:
    logger.error(errmsg)
    platform = None
    logger.warning('Could not Revit Document. Will Import Sphinx Compat Vars')
    from rpw.utils.sphinx_compat import *

# Imported Revit's Assemblies
else:
    try:
        uidoc = __revit__.ActiveUIDocument
        doc = __revit__.ActiveUIDocument.Document
        version = __revit__.Application.VersionNumber.ToString()
        platform = {'revit': version}
        logger.info("Running In Revit")

    except NameError:
        logger.debug('Could not find pyRevit Document. Trying Dynamo.')