hi. I wrote my code in pycharm first and I was not able to link the output with dynamo for visualization of output in Revit. then I started in dynamo. i parse my excel data but I am not able to write the pycharm loop code in my dynamo python script. offset coordinates.dyn (67.1 KB) roof edges+S.txt (1.5 KB) (pycharm code that I want to run in dynamo ) s data.xlsx (7.9 KB) the excel sheetscoordinates.xlsx (9.2 KB)
#importing openpyxl module
import openpyxl
# workbook object is created
workbook1 = openpyxl.load_workbook("edges.coordinates.xlsx")
workbook2 = openpyxl.load_workbook("s data.xlsx")
#For sheet1
sheet_obj1 = workbook1["sheet1"]
#For sheet2
sheet_obj2 = workbook1["sheet2"]
#for s workbook
sheet_obj3 = workbook2["sheet1"]
# Will print a particular row value
for j in range(0, sheet_obj3.max_row):
#Fetching Data From Cell For Sheet1/workbook 2
x= sheet_obj3.cell(row = 1+j, column = 1).value
y = sheet_obj3.cell(row = 1+j, column = 2).value
z = sheet_obj3.cell(row = 1+j, column = 3).value
# Will print a particular row value
for i in range(1, sheet_obj1.max_row):
#Fetching Data From Cell For Sheet1
x1 = sheet_obj1.cell(row = i, column = 1)
y1 = sheet_obj1.cell(row = i, column = 2)
x2 = sheet_obj1.cell(row = i+1, column = 1)
y2 = sheet_obj1.cell(row = i+1, column = 2)
z1 = sheet_obj1.cell(row = i, column = 3)
#Fetching Data From Cell For Sheet2
x11 = sheet_obj2.cell(row = i, column = 1)
y11 = sheet_obj2.cell(row = i, column = 2)
x22 = sheet_obj2.cell(row = i+1, column = 1)
y22 = sheet_obj2.cell(row = i+1, column = 2)
#Printing Warning If Condition Is Satisfied
if z == z1.value:
if min(x1.value,x2.value,x11.value,x22.value)<=x <=max(x1.value,x2.value,x11.value,x22.value) and min(y1.value,y2.value,y11.value,y22.value)<=y<=max(y1.value,y2.value,y11.value,y22.value):
print("Warning Between Row"+str(i)+" and Row"+str((i+1)))