예제 #1
0
def rename_sheets(data_dict, sheets_by_name):
    logging.debug(util_ra.get_self())
    cnt_updated = 0
    for i, row in enumerate(data_dict):
        assert row[
            'SOURCE'] == 'RVT', "Only works with RVT drawings, not [{}]".format(
                row['SOURCE'])

        #if row['OLD NAME']:
        #    assert row['OLD NAME'] in sheets_by_name, "{} sheet not found in project".format(row['OLD NAME'])
        #else:
        #    continue

        # Select this sheet to update
        this_sheet = sheets_by_name[row['Sheet Name']]

        # Change OLD NAME to Sheet Name column
        #         util_ra.change_parameter(rvt_doc,
        #                                  this_sheet,
        #                                  'Sheet Name',
        #                                  row['Sheet Name'])

        # Update Sheet Number from Sheet Number column
        try:
            util_ra.change_parameter(rvt_doc, this_sheet, 'Sheet Number',
                                     row['Sheet Number'])
            cnt_updated += 1
        except:
            logging.error("Couldn't update parameter!".format())

        logging.debug("Updated {}".format(row['Sheet Name']))

    logging.debug("Successfully change {} out of {} sheets".format(
        cnt_updated, i))
예제 #2
0
def rename_sheets(data_dict, sheets_by_name):
    logging.debug(util_ra.get_self())
    cnt_updated = 0
    for i,row in enumerate(data_dict):
        assert row['SOURCE'] == 'RVT', "Only works with RVT drawings, not [{}]".format(row['SOURCE'])
        
        #if row['OLD NAME']:
        #    assert row['OLD NAME'] in sheets_by_name, "{} sheet not found in project".format(row['OLD NAME'])
        #else:
        #    continue
        
        # Select this sheet to update
        this_sheet = sheets_by_name[row['Sheet Name']]
        
        # Change OLD NAME to Sheet Name column
#         util_ra.change_parameter(rvt_doc, 
#                                  this_sheet, 
#                                  'Sheet Name', 
#                                  row['Sheet Name'])
        
        # Update Sheet Number from Sheet Number column
        try:
            util_ra.change_parameter(rvt_doc, 
                                     this_sheet, 
                                     'Sheet Number', 
                                     row['Sheet Number'])
            cnt_updated += 1     
        except: 
            logging.error("Couldn't update parameter!".format())
            
        logging.debug("Updated {}".format(row['Sheet Name']))
    
    logging.debug("Successfully change {} out of {} sheets".format(cnt_updated,i))
예제 #3
0
def update_view_parameters(excel_dict, all_views):
    logging.debug(util_ra.get_self())
    count_total_rows = 0
    count_total_rvt = 0

    for i, row in enumerate(excel_dict):
        count_total_rows += 1

        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] != 'PLAN':
            continue
        assert row['View Name'] in all_views, "View {} does not exist".format(
            row['View Name'])
        # Get view (exists)

        logging.debug("Processing {} rows".format(row['View Name']))

        this_view = all_views[row['View Name']]

        # Update scale
        #flg_exists = util_ra.parameter_exists(this_view, 'Scale Value    1:')
        #util_ra.table_parameters(this_view)
        #print(this_view)
        logging.debug("Changing scale of view from {} to {}".format(
            this_view.Scale, row['SCALE']))

        with util_ra.Trans(rvt_doc, "Change scale"):
            this_view.Scale = int(row['SCALE'])
예제 #4
0
def create_sheets(data_dict, sheets_by_name, title_block):
    """
    Create a new blank sheet with NAME and NUMBER on TITLEBLOCK
    """
    logging.debug(util_ra.get_self())
    
    #assert "TEMPLATE" in sheets_by_name, "Template does not exist"
    
    sheet_numbers = [sheets_by_name[sheet_name].SheetNumber for sheet_name in sheets_by_name]
    
    #template_sheet = sheets_by_name["TEMPLATE"]
    cnt_new = 0
    #print(sheets_by_name)
    for i,row in enumerate(data_dict):
        assert row['SOURCE'] == 'RVT', "Only works with RVT drawings, not [{}]".format(row['SOURCE'])
        if row['Sheet Name'] not in sheets_by_name:
            if row['Sheet Number'] in sheet_numbers:
                logging.error("Sheet number {} already exists".format(row['Sheet Number']))
                raise    
                    
            #print("CREATE:",row['Sheet Name'])
            #assert row["View Name"] in views, "View {} does not exist"
            util_ra.create_sheet(rvt_doc, title_block, row['Sheet Number'], row['Sheet Name'])
            cnt_new+=1
    logging.debug("Created {} sheets".format(cnt_new))
예제 #5
0
def rename_sheets(data_dict, sheets_by_name):
    raise "OBSELETE SEE CREATE SHEETS"    
    logging.debug(util_ra.get_self())
    
    for i,row in enumerate(data_dict):
        assert row['SOURCE'] == 'RVT', "Only works with RVT drawings, not [{}]".format(row['SOURCE'])
        if row['OLD NAME']:
            assert row['OLD NAME'] in sheets_by_name, "{} sheet not found in project".format(row['OLD NAME'])
        else:
            continue
        
        this_sheet = sheets_by_name[row['OLD NAME']]
        
        # Change OLD NAME to Sheet Name column
        util_ra.change_parameter(rvt_doc, 
                                 this_sheet, 
                                 'Sheet Name', 
                                 row['Sheet Name'])
        
        # Change OLD NUMBER to Sheet Number column
        util_ra.change_parameter(rvt_doc, 
                                 this_sheet, 
                                 'Sheet Number', 
                                 row['Sheet Number'])        
        
        logging.debug("Updated {}".format(row['OLD NAME']))
예제 #6
0
def rename_sheets(data_dict, sheets_by_name):
    raise "OBSELETE SEE CREATE SHEETS"
    logging.debug(util_ra.get_self())

    for i, row in enumerate(data_dict):
        assert row[
            'SOURCE'] == 'RVT', "Only works with RVT drawings, not [{}]".format(
                row['SOURCE'])
        if row['OLD NAME']:
            assert row[
                'OLD NAME'] in sheets_by_name, "{} sheet not found in project".format(
                    row['OLD NAME'])
        else:
            continue

        this_sheet = sheets_by_name[row['OLD NAME']]

        # Change OLD NAME to Sheet Name column
        util_ra.change_parameter(rvt_doc, this_sheet, 'Sheet Name',
                                 row['Sheet Name'])

        # Change OLD NUMBER to Sheet Number column
        util_ra.change_parameter(rvt_doc, this_sheet, 'Sheet Number',
                                 row['Sheet Number'])

        logging.debug("Updated {}".format(row['OLD NAME']))
예제 #7
0
def update_sheets_views(excel_dict, sheets_by_name, views, viewports):
    logging.debug(util_ra.get_self())
    count = 0
    for i,row in enumerate(excel_dict):
        
        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] != 'PLAN':
            continue

        assert row['Sheet Name'] in sheets_by_name, "Sheet {} does not exist".format(row['Sheet Name'])
        assert row['View Name'] in views, "View {} does not exist".format(row['View Name'])
        assert row['MAIN VIEWPORT'] in viewports, "Viewport {} does not exist".format(row['MAIN VIEWPORT'])

        # Test views in register matches views placed in Revit
        placed_views = sheets_by_name[row['Sheet Name']].GetAllPlacedViews() 
        view_match = False
        legend_match = False
        for view_id in placed_views:
            view = rvt_doc.GetElement(view_id)
            if view.Name == row['View Name']:
                view_match = True
                
        # Test view match
        if not view_match:
            count+=1
            print("Add {} to {}".format(row['View Name'],row['Sheet Name']))
            util_ra.add_view_sheet(rvt_doc, 
                                   sheets_by_name[row['Sheet Name']], 
                                   views[row['View Name']], 
                                   OVERVIEWPLAN_CENTER,
                                   viewports[row['MAIN VIEWPORT']].GetTypeId())
                
    logging.debug("Added views to {} sheets".format(count))
예제 #8
0
def check_sheets(excel_dict, sheets_by_name, views):
    logging.debug(util_ra.get_self())

    count_total_rows = 0
    count_total_rvt = 0
    count_missing_view = 0
    count_missing_sheet = 0
    count_missing_view = 0
    for i, row in enumerate(excel_dict):
        count_total_rows += 1
        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] == 'PLAN':
            count_total_rvt += 1

            logging.info("CHECK: {} {} {} View: {} Legend: {} Loc: {}".format(
                row['Sheet Name'], row['Sheet Number'], row['PAPER SIZE'],
                row['View Name'], row['LEGEND'], row['LOCATION LEGEND']))

            # Test sheet exists
            if row['Sheet Name'] not in sheets_by_name:
                count_missing_sheet += 1
                logging.error("Sheet {} does not exist".format(
                    row['Sheet Name']))

            # Test view exists
            if row['View Name'] not in views:
                count_missing_view
                logging.error("View {} does not exist".format(
                    row['View Name']))

            # Test view in register matches view in Revit over sheet placed views
            if (row['Sheet Name'] not in sheets_by_name
                    and row['View Name'] not in views):
                placed_views = sheets_by_name[
                    row['Sheet Name']].GetAllPlacedViews()
                view_match = False
                for view_id in placed_views:
                    view = rvt_doc.GetElement(view_id)
                    if view.Name == row['View Name']:
                        view_match = True

                #assert view_match
                if not view_match:
                    count_missing_view += 1
                    logging.error("View {} not placed on {}".format(
                        row['Sheet Name'], row['View Name']))

    logging.debug("Iterated {} document rows".format(count_total_rows))
    logging.debug("Checked {} sheets_by_name (RVT plan views only)".format(
        count_total_rvt))
    logging.debug("Missing sheets: {} ".format(count_missing_sheet))
    logging.debug("Missing views: {}".format(count_missing_view))
    logging.debug("{} placed sheets had a missing or unmatched view".format(
        count_missing_view))
예제 #9
0
def check_sheets(excel_dict, sheets_by_name, views):
    logging.debug(util_ra.get_self())
    
    count_total_rows = 0
    count_total_rvt = 0
    count_missing_view = 0
    count_missing_sheet = 0
    count_missing_view = 0
    for i,row in enumerate(excel_dict):
        count_total_rows += 1
        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] == 'PLAN':
            count_total_rvt += 1

            logging.info("CHECK: {} {} {} View: {} Legend: {} Loc: {}".format(row['Sheet Name'],
                                     row['Sheet Number'],
                                     row['PAPER SIZE'],
                                     row['View Name'],
                                     row['LEGEND'],
                                     row['LOCATION LEGEND']
                                     ))
           
            # Test sheet exists
            if row['Sheet Name'] not in sheets_by_name:
                count_missing_sheet+=1
                logging.error("Sheet {} does not exist".format(row['Sheet Name']))
                
            
            # Test view exists
            if row['View Name'] not in views:
                count_missing_view
                logging.error("View {} does not exist".format(row['View Name']))
                                
            # Test view in register matches view in Revit over sheet placed views
            if (row['Sheet Name'] not in sheets_by_name and 
                row['View Name'] not in views):
                placed_views = sheets_by_name[row['Sheet Name']].GetAllPlacedViews() 
                view_match = False
                for view_id in placed_views:
                    view = rvt_doc.GetElement(view_id)
                    if view.Name == row['View Name']:
                        view_match = True
                
                #assert view_match
                if not view_match:
                    count_missing_view+=1
                    logging.error("View {} not placed on {}".format(row['Sheet Name'], row['View Name']))

    logging.debug("Iterated {} document rows".format(count_total_rows))
    logging.debug("Checked {} sheets_by_name (RVT plan views only)".format(count_total_rvt))
    logging.debug("Missing sheets: {} ".format(count_missing_sheet))
    logging.debug("Missing views: {}".format(count_missing_view))
    logging.debug("{} placed sheets had a missing or unmatched view".format(count_missing_view))    
def place_location_sheet(excel_dict, sheets_by_name, legends, all_viewports):

    logging.debug(util_ra.get_self())
    count = 0
    for i, row in enumerate(excel_dict):
        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] != 'PLAN':
            continue
        assert row[
            'Sheet Name'] in sheets_by_name, "Sheet {} does not exist".format(
                row['Sheet Name'])
        assert row[
            'LOCATION LEGEND'] in legends, "View {} does not exist".format(
                row['View Name'])
        assert row[
            'LOC LEG VIEWPORT'] in all_viewports, "Viewport family {} does not exist".format(
                row['LOC LEG VIEWPORT'])

        #print(row['Sheet Name'],row['LOCATION LEGEND'],legends[row['LOCATION LEGEND']])
        # Test views in register matches views placed in Revit
        placed_views = sheets_by_name[row['Sheet Name']].GetAllPlacedViews()
        view_match = False
        legend_match = False
        for view_id in placed_views:
            view = rvt_doc.GetElement(view_id)
            if view.Name == row['LOCATION LEGEND']:
                view_match = True

        # Test view match
        if not view_match:
            count += 1
            new_viewport_type = all_viewports[row['LOC LEG VIEWPORT']]
            new_vp_id = new_viewport_type.GetTypeId()

            logging.debug("Adding {} to {} using {}".format(
                row['LOCATION LEGEND'], row['Sheet Name'],
                new_viewport_type.Name))
            view_port = util_ra.add_view_sheet(
                rvt_doc, sheets_by_name[row['Sheet Name']],
                legends[row['LOCATION LEGEND']], LOCATIONPLAN_CENTER,
                new_vp_id)

    logging.debug("Added location views to {} sheets".format(count))
def update_sheets_views(excel_dict, sheets_by_name, views, viewports):
    logging.debug(util_ra.get_self())
    count = 0
    for i, row in enumerate(excel_dict):

        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] != 'PLAN':
            continue

        assert row[
            'Sheet Name'] in sheets_by_name, "Sheet {} does not exist".format(
                row['Sheet Name'])
        assert row['View Name'] in views, "View {} does not exist".format(
            row['View Name'])
        assert row[
            'MAIN VIEWPORT'] in viewports, "Viewport {} does not exist".format(
                row['MAIN VIEWPORT'])

        # Test views in register matches views placed in Revit
        placed_views = sheets_by_name[row['Sheet Name']].GetAllPlacedViews()
        view_match = False
        legend_match = False
        for view_id in placed_views:
            view = rvt_doc.GetElement(view_id)
            if view.Name == row['View Name']:
                view_match = True

        # Test view match
        if not view_match:
            count += 1
            print("Add {} to {}".format(row['View Name'], row['Sheet Name']))
            util_ra.add_view_sheet(rvt_doc, sheets_by_name[row['Sheet Name']],
                                   views[row['View Name']],
                                   OVERVIEWPLAN_CENTER,
                                   viewports[row['MAIN VIEWPORT']].GetTypeId())

    logging.debug("Added views to {} sheets".format(count))
def resize_crop(excel_dict, sheets_by_name, all_views):

    logging.debug(util_ra.get_self())
    count = 0
    for i, row in enumerate(excel_dict):
        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] != 'PLAN':
            continue
        if row['PART'] not in ['1', '2', '3', '4', '5', '6']:
            continue
        assert row[
            'Sheet Name'] in sheets_by_name, "Sheet {} does not exist".format(
                row['Sheet Name'])
        assert row['View Name'] in all_views, "View {} does not exist".format(
            row['View Name'])

        #assert row['LOCATION LEGEND'] in legends, "View {} does not exist".format(row['View Name'])
        #assert row['LOC LEG VIEWPORT'] in all_viewports, "Viewport family {} does not exist".format(row['LOC LEG VIEWPORT'])

        print(row['Sheet Name'], row['View Name'])

        this_view = all_views[row['View Name']]
        print(this_view.CropBox)
        raise
예제 #13
0
def update_sheets_views_viewport(excel_dict, sheets_by_name, views, view_ports):
    logging.debug(util_ra.get_self())
    count = 0
    count_added = 0

    for i,row in enumerate(excel_dict):
        count += 1
        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] != 'PLAN':
            continue
        assert row['Sheet Name'] in sheets_by_name, "Sheet {} does not exist".format(row['Sheet Name'])
        assert row['View Name'] in views, "View {} does not exist".format(row['View Name'])
        assert row['MAIN VIEWPORT'] in view_ports, "Viewport {} does not exist".format(row['MAIN VIEWPORT'])
        
        #logging.debug("Processing {} with {}".format(row['Sheet Name'],row['View Name']))
        
#         placed_views = sheets_by_name[row['Sheet Name']].GetAllPlacedViews() 
#         for view_id in placed_views:
#             
#             view = rvt_doc.GetElement(view_id)
#             #print("\t{} placed on sheet".format(view))
#             
#             #view_port.ChangeTypeId(viewport_ID)
#             #if view.Name == row['View Name']:
#             #    view_match = True
#             
        for viewport_id in sheets_by_name[row['Sheet Name']].GetAllViewports():
            #print(viewport_id)
            
            viewport = rvt_doc.GetElement(viewport_id)
            view_id = viewport.ViewId
            this_view = rvt_doc.GetElement(view_id)
            
            #print(viewport, this_view)
            #print(viewport, this_view.Name)
            flg_found = False
            if this_view.Name == row['View Name']:
                logging.debug("View {} found on sheet {}".format(this_view.Name,row['Sheet Name']))
                #print(viewport.Location.ToString())
                #util_ra.print_dir(viewport.Location)
                #raise
                flg_found = True
                break 
            
        #assert flg_found, "{} not found on sheet {}".format(row['View Name'],row['Sheet Name'])
        
        # Delete viewport
        with util_ra.Trans(rvt_doc,"Delete viewport"):
            try:
                rvt_doc.Delete(viewport.Id)
            except:
                logging.error("Couldn't delete viewport".format())
                
        # Replace viewport
        try:
            util_ra.add_view_sheet(rvt_doc, 
                                   sheets_by_name[row['Sheet Name']], 
                                   views[row['View Name']], 
                                   OVERVIEWPLAN_CENTER,
                                   view_ports[row['MAIN VIEWPORT']].GetTypeId()
                                   )
            count_added += 1
        except:
            logging.error("Couldn't recreate viewport with ID {}".format(view_ports[row['MAIN VIEWPORT']].GetTypeId()))
            
    print("Added {} viewports over {} rows")
예제 #14
0
def update_sheet_parameters(excel_dict, sheets_by_name, flg_update=False, verbose=False):
    logging.debug(util_ra.get_self())
    count_total_rows = 0
    count_total_rvt = 0
    focus_params =[
                   #'Project Number', # PROJECT PARAM
                   #'Project Status', # PP
                   'Designing Company', # YES
                   'Project Manager MEP', # YES
                   'Project Manager ID',# YES
                   'Designer', # YES
                   'Designer ID', # YES
                   'Draftsperson', # YES
                   #'Sheet Name' # PP
                   'Design', # YES
                   'Design No.', # YES
                   #'Drawing Type',
                   #'Project Status',
                   'Sheet Issue Date',
                   'Revision',
                   ]
    for i,row in enumerate(excel_dict):
        count_total_rows += 1
        if row['SOURCE'] == 'RVT':
            count_total_rvt+=1
            # Get sheet (exists)
            try: this_sheet = sheets_by_name[row['Sheet Name']]
            except:
                logging.error("Sheet {} does not exist".format(sheet_name))
                raise
            
            sheet_name = row['Sheet Name']
            
            for k in row:
                if k in focus_params:
                    # 
                    flg_exists = util_ra.parameter_exists(this_sheet, k)
                    if flg_exists:
                        value = util_ra.get_parameter_value(this_sheet, k)
                    else:
                        value = ""
                    
                    if row[k] == value:
                        flg_match = True
                    else:
                        flg_match = False
                        
                    if verbose:
                        print("Row {0} {1:20} Exists:{2:10} Value:{3:20} New Value:{4:20} Match:{5:10}".format())
                              
                              
                else:
                    if verbose:
                        print("Skipped {}".format(k))
                
                if k in focus_params and not flg_match:
                    util_ra.change_parameter(rvt_doc, this_sheet, k, row[k])
            #util_ra.table_parameters(this_sheet)
            
    logging.debug("Iterated {} document rows".format(count_total_rows))
    logging.debug("Checked {} sheets_by_name (RVT plan views only)".format(count_total_rvt))
예제 #15
0
def update_sheet_parameters(excel_dict,
                            sheets_by_name,
                            flg_update=False,
                            verbose=False):
    logging.debug(util_ra.get_self())
    count_total_rows = 0
    count_total_rvt = 0
    focus_params = [
        #'Project Number', # PROJECT PARAM
        #'Project Status', # PP
        'Designing Company',  # YES
        'Project Manager MEP',  # YES
        'Project Manager ID',  # YES
        'Designer',  # YES
        'Designer ID',  # YES
        'Draftsperson',  # YES
        #'Sheet Name' # PP
        'Design',  # YES
        'Design No.',  # YES
        #'Drawing Type',
        #'Project Status',
        'Sheet Issue Date',
        'Revision',
    ]
    for i, row in enumerate(excel_dict):
        count_total_rows += 1
        if row['SOURCE'] == 'RVT':
            count_total_rvt += 1
            # Get sheet (exists)
            try:
                this_sheet = sheets_by_name[row['Sheet Name']]
            except:
                logging.error("Sheet {} does not exist".format(sheet_name))
                raise

            sheet_name = row['Sheet Name']

            for k in row:
                if k in focus_params:
                    #
                    flg_exists = util_ra.parameter_exists(this_sheet, k)
                    if flg_exists:
                        value = util_ra.get_parameter_value(this_sheet, k)
                    else:
                        value = ""

                    if row[k] == value:
                        flg_match = True
                    else:
                        flg_match = False

                    if verbose:
                        print(
                            "Row {0} {1:20} Exists:{2:10} Value:{3:20} New Value:{4:20} Match:{5:10}"
                            .format())

                else:
                    if verbose:
                        print("Skipped {}".format(k))

                if k in focus_params and not flg_match:
                    util_ra.change_parameter(rvt_doc, this_sheet, k, row[k])
            #util_ra.table_parameters(this_sheet)

    logging.debug("Iterated {} document rows".format(count_total_rows))
    logging.debug("Checked {} sheets_by_name (RVT plan views only)".format(
        count_total_rvt))
def update_sheets_views_viewport(excel_dict, sheets_by_name, views,
                                 view_ports):
    logging.debug(util_ra.get_self())
    count = 0
    count_added = 0

    for i, row in enumerate(excel_dict):
        count += 1
        assert row['SOURCE'] == 'RVT'
        if row['VIEW TYPE'] != 'PLAN':
            continue
        assert row[
            'Sheet Name'] in sheets_by_name, "Sheet {} does not exist".format(
                row['Sheet Name'])
        assert row['View Name'] in views, "View {} does not exist".format(
            row['View Name'])
        assert row[
            'MAIN VIEWPORT'] in view_ports, "Viewport {} does not exist".format(
                row['MAIN VIEWPORT'])

        #logging.debug("Processing {} with {}".format(row['Sheet Name'],row['View Name']))

        #         placed_views = sheets_by_name[row['Sheet Name']].GetAllPlacedViews()
        #         for view_id in placed_views:
        #
        #             view = rvt_doc.GetElement(view_id)
        #             #print("\t{} placed on sheet".format(view))
        #
        #             #view_port.ChangeTypeId(viewport_ID)
        #             #if view.Name == row['View Name']:
        #             #    view_match = True
        #
        for viewport_id in sheets_by_name[row['Sheet Name']].GetAllViewports():
            #print(viewport_id)

            viewport = rvt_doc.GetElement(viewport_id)
            view_id = viewport.ViewId
            this_view = rvt_doc.GetElement(view_id)

            #print(viewport, this_view)
            #print(viewport, this_view.Name)
            flg_found = False
            if this_view.Name == row['View Name']:
                logging.debug("View {} found on sheet {}".format(
                    this_view.Name, row['Sheet Name']))
                #print(viewport.Location.ToString())
                #util_ra.print_dir(viewport.Location)
                #raise
                flg_found = True
                break

        #assert flg_found, "{} not found on sheet {}".format(row['View Name'],row['Sheet Name'])

        # Delete viewport
        with util_ra.Trans(rvt_doc, "Delete viewport"):
            try:
                rvt_doc.Delete(viewport.Id)
            except:
                logging.error("Couldn't delete viewport".format())

        # Replace viewport
        try:
            util_ra.add_view_sheet(
                rvt_doc, sheets_by_name[row['Sheet Name']],
                views[row['View Name']], OVERVIEWPLAN_CENTER,
                view_ports[row['MAIN VIEWPORT']].GetTypeId())
            count_added += 1
        except:
            logging.error("Couldn't recreate viewport with ID {}".format(
                view_ports[row['MAIN VIEWPORT']].GetTypeId()))

    print("Added {} viewports over {} rows")