"Dimension Grid Column in Digit,Grid Row in Charactor\n\n\n Updated : 01-05-2024 \n\n Shared by : TUMCIVIL"
__author__ = 'TUMCIVIL'
__version__ = '1.0.0'
__title__ = 'Create\nGridsLine'

# Import commom language runtime
import clr
import Autodesk
from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument

# print("Input Column Grids : ")
# n = raw_input()
# for i in range(n-1):

# Create Grid Row
R_1 = XYZ(-50,45,0)
R_2 = XYZ(25,45,0)
R_3 = XYZ(-50,(45-5000/304.8),0)
R_4 = XYZ(25,(45-5000/304.8),0)
R_5 = XYZ(-50,(45-10000/304.8),0)
R_6 = XYZ(25,(45-10000/304.8),0)
R_7 = XYZ(-50,(45-15000/304.8),0)
R_8 = XYZ(25,(45-15000/304.8),0)
line_R1 = Line.CreateBound(R_1, R_2)
line_R2 = Line.CreateBound(R_3, R_4)
line_R3 = Line.CreateBound(R_5, R_6)
line_R4 = Line.CreateBound(R_7, R_8)
t = Transaction(doc, 'grid')
t.Start()
grid_R1 = Grid.Create(doc, line_R1)
grid_R2 = Grid.Create(doc, line_R2)
grid_R3 = Grid.Create(doc, line_R3)
grid_R4 = Grid.Create(doc, line_R4)
name = grid_R1.get_Parameter(BuiltInParameter.DATUM_TEXT)
name.Set('A')
name = grid_R2.get_Parameter(BuiltInParameter.DATUM_TEXT)
name.Set('B')
name = grid_R3.get_Parameter(BuiltInParameter.DATUM_TEXT)
name.Set('C')
name = grid_R4.get_Parameter(BuiltInParameter.DATUM_TEXT)
name.Set('D')
t.Commit()
# Create Grid Column
C_1 = XYZ(-35,60,0)
C_2 = XYZ(-35,-15,0)
C_3 = XYZ(-(35-5000/304.8),60,0)
C_4 = XYZ(-(35-5000/304.8),-15,0)
C_5 = XYZ(-(35-10000/304.8),60,0)
C_6 = XYZ(-(35-10000/304.8),-15,0)
C_7 = XYZ(-(35-15000/304.8),60,0)
C_8 = XYZ(-(35-15000/304.8),-15,0)
line_C1 = Line.CreateBound(C_1, C_2)
line_C2 = Line.CreateBound(C_3, C_4)
line_C3 = Line.CreateBound(C_5, C_6)
line_C4 = Line.CreateBound(C_7, C_8)
t = Transaction(doc, 'grid')
t.Start()
grid_C1 = Grid.Create(doc, line_C1)
grid_C2 = Grid.Create(doc, line_C2)
grid_C3 = Grid.Create(doc, line_C3)
grid_C4 = Grid.Create(doc, line_C4)
name = grid_C1.get_Parameter(BuiltInParameter.DATUM_TEXT)
name.Set('1')
name = grid_C2.get_Parameter(BuiltInParameter.DATUM_TEXT)
name.Set('2')
name = grid_C3.get_Parameter(BuiltInParameter.DATUM_TEXT)
name.Set('3')
name = grid_C4.get_Parameter(BuiltInParameter.DATUM_TEXT)
name.Set('4')
t.Commit()