"Cleaning data concrete Walls in Model \n\n\n Updated : 01-05-2024 \n\n Shared by : TUMCIVIL"
__author__ = 'TUMCIVIL'
__version__ = '1.0.0'
__title__ = ' Cleaning Data Walls'
# for timing -------------------------------------------------------------------
import pyrevit.coreutils as cor
from pyrevit.coreutils import Timer
timer = Timer()
# ------------------------------------------------------------------------------
import sys
import csv
import codecs
import os.path as op
from collections import defaultdict

from pyrevit import PyRevitException
from pyrevit import forms
from pyrevit import coreutils
from pyrevit import revit, DB, HOST_APP
from pyrevit import script
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.DB.Structure import *
import re

doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument

def walls():
    walls = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_Walls) \
        .WhereElementIsNotElementType() \
        .ToElements()

    # print("Data = {}".format(param_data))
    out = []
    for e in walls:
        q1 = ""
        q2 = ""
        q3 = ""
        q4 = ""
        q5 = ""
        q6 = ""
        q7 = ""
        t = Transaction(doc, 'change parameter')
        t.Start()
        try:
            e.LookupParameter("Location").Set(q1)
            e.LookupParameter("Name Core Wall").Set(q2)
            e.LookupParameter("Size").Set(q3)
            e.LookupParameter("Group").Set(q4)
            e.LookupParameter("Strength Concrete").Set(q5)
            e.LookupParameter("Bottom of Wall").Set(q6)
            e.LookupParameter("Top of Wall").Set(q7)

        except:
            # TaskDialog.Show('error', 'error message')
            pass
        t.Commit()


if __name__ == "__main__":
    walls()

# for timing -------------------------------------------------------------------
print("====" * 20)
print("CLEANING DATA WALLS COMPLETELY !")
endtime = timer.get_time()
print("Time been used = {} sec.".format(endtime))
currentDate = cor.current_date()
currentTime = cor.current_time()
print ("Date : {} ; {}".format(currentDate,currentTime))
print ("Credited by : {}".format(__author__))
print("====" * 20)
# ------------------------------------------------------------------------------