Python. itteration of elements in list. for loop

Hi. i am sharing my dynamo python code. i have scripted this code in pycharm but finding it really hard to write the same code in dynamo.
basically what I am doing is I have 2 sheets in excel that give me a range and 3rd sheet with values. I want to check that wether any row of the 3rd sheet is in the range of the first 2 sheets. I imported three excel sheets to dynamo and made a list of each column (3 columns of each excel sheet). i want to apply for loop so that each value is checked wether its in the range or not. but I don’t how to call each element of the list in dynamo python script to run the for loop.

IN(0)= SHEET 1 COLUMN 2
IN(2)= SHEET 1 COLUMN 2

offset coordinates.dyn (80.6 KB)

Would you mind also sharing your Excel? It helps us to get an understanding of what you are doing.

roof edges+S.txt (1.5 KB) (the pycharm code that I want run in dynamo)
s data.xlsx (7.9 KB) ( the sheet which is to be checked)
coordinates.xlsx (9.2 KB) .( the two sheets to set the range)

Okay so i am looking at the code you shared and there are a few things which don’t in IronPython.

To verify: Do you want to make you python code work in Dynamo?

OR

Do you want something wich can detect point within a certain boundary? This can be done without any python in Dynamo and is easier to explain.

i want to detect point with in a certain boundary. like whenever my any of the input coordinates (s data xlsx) are within those coordinates it gives a warning on revit

i just scripted a code in python but now i am not able to write the same code in python

.
i have coordinates at the edges 1,2,3,4,5,6… (sheet 1 of the coordinates.xlsx) and the coordinates at the inner boundary ( sheet 2 of the edges ). sheet s data has multiple rows that i want to check that if any row has coordinates between the edges and inner boundary it should give a warning in revit ( print a warning in pycharm).

Like I mentioned, to detect if a point lays within a certain boundary is very easy to do in Dynamo without python.

Below you see the 2 boundary lines. I made an example on how to do this with predefined functions in Dynamo. You can also make it very visible with Red (Points lay between the boundaries) and Green (Points dont lay between the boundaries)

Let me know if this works for you. If you would rather do all this in Python, let me know and we will take a look at the code in Python.


CheckIfCoordinatesLayInBoundary.dyn (98.4 KB)

1 Like

there is no error but still, it shows run completed with a warning.
its not showing red and green points.

The Red and Green points only show in Dynamo.

You can toggle this in Dynamo → View → background preview.

I don’t know why it still gives a warning, maybe there is a node somewhere which is not connected.

no the veiw is still no available?

(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)

thankyou its solved

Do you know why it was grayed out?