Back from a short break from working with revit.
I am creating a code which takes the corners of the top surface and bottom surface and connects a line between them (end goal is to create longitude rebar).
I managed to get to the point where I have a list of points of the bottom and top surface, and I create a python code which creates a list of the top points and bottom points by crossing the X,Y coordinates and the points with smaller Z value goes to the Bot list and the points with greater Z values go to the Top list.
But then I tried to add a ceiling on top of the column to test the top point’s values and to my surprise - I now get only two lines…
Attaching the code to the post.
Any idea why this happens?
li=IN if isinstance(IN,list) else [IN] Bot=[ ] Top=[ ] flag=0 for point in li: for point2 in li: #Cross point in list against other points in list for poi in Bot: #if point has beened checked previously - flag if poi == point: flag =1 break if flag==0: for poi in Top: #if point has beened checked previously - flag if poi == point: flag =1 break if flag: flag=0 continue #if point has beened flagged - continue to next point if point2==point: #If point is the same being checked - continue continue if point2.X == point.X and point2.Y == point.Y: #If 2 points have same x, y coordinates if point.Z<point2.Z: #If Z coordinate is smaller - assign to Bot Bot.append(point) Top.append(point2) else: #Else - assign to Top Bot.append(point2) Top.append(point) break OUT = Bot,Top
The python code is coming out a bit broken in the post so I’ll try and explain the beginning:
It receives the list of points in variable “li”. I created a nested for loop which crosses the point in the list to the rest of the points in the list.