Organize Wall Data - Based on X and Y Location and Elevations

I am trying to organize wall data into lists of lists based on x and y coordinates and I am struggling to even logically think about a way to perform the following operation. Any help would be appreciated.

Essentially, the end product I want is an organized list of wall data, that, if the start and end points of a wall are within some given tolerance (say +/- 0.5 feet), they will say they are close enough and spit out a lists of lists that is organized based on elevation.

An example probably more clearly illustrates my goals:
revit%20input

In the picture shown above, list 3 and list 4 are seperated because the program has recoginized that the end location of the wall x and y coordinates is greater than the given tolerance.

Thoughts on how to solve this are as follows:

  1. Write some python code that sees how many unique sets of unique x and y coordinates there are, this sets how many main lists I have (.

  2. Based on these unique set of x and y coordinates, find all walls with that x and y coordinates. This creates an unorganized sublist with levels that could be jumbled

  3. Sort sublists based on elevation data within sublist.

I am going to start digging into this with some python code, but wanted to get some feelers out there if this is the way that others would go about solving this.

Thanks!

Ok, part one is tough from what I have discovered :grinning:.

Trying to code the base number of lists to populate is not easy. I have been able to sort start points and points by x and y coordinates, but trying to figure out a way to code this if (2) walls are concurrent is difficult.

Originally is was trying x starting point - x any other point etc. and comparing to some tolerances but now my train of thought has shifted.

I almost think I am going to break these walls down into the equation of a line:
y = mx + b
if m and b are within some tolerance, say lines are concurrent?

I will keep this thread updated. things that i will need to explore is if lines with +/- m can be handled etc.

I believe Springs has a group by distance node that you can use with the Element.GetLocation or something similar. That should let you group things that are within an x distance.

Thanks for the help kenny, but I think I might like this y = mx+b idea I have going right now.

I’ve written the following python script for solving for m and b. Do you know of anyway in python to output both m and b?

I can output either m or b, but trying to do both gives me an error:
python%20script

Still new to understanding python code.

To output more than one variable, output a list of all of the variables. For here, you want:

OUT = [temp, b]

and then you can separate them with a code block afterwords with

x[0];
x[1];

Ok thank Kenny, got that, now onto organizing data.

Essentially i have now organized my slope data (m) with corresponding wall identities and I want to do the same with my b data. I think using sort by key option is the node I want, but I am struggling to organize my b data to match that of the m data.

see below:
dynamo%20script
any thoughts on how to achieve this?

Alright, almost solved part 1 of the problem, I now have a known number of unique walls, but I need to know how many elements are associated with each unique wall.


Python script shown below:
python%20script

I think I need to add some sort of counter variable in my python script to keep count of the quantity within each loop. I have also never wrtten data to variable before that has unknown size, @kennyb6 , do you know how you would handle this?

Thanks again for your help!

I am confused with what you are doing. You have a counter with the line count = count + 1. Are you trying to initialize a list called ‘value’ and then replace within the list at index a? Is the point of this to keep the same structure but with a new value? What should be inside ‘value’ when not filled with a?

goal here is to have one output with the unique number walls (see screen shot up at the very beginning) this is the base list.

Within this baselist, I also want to know how many walls are stacked up.

In my example listed in my screen shot I would expect the value output to return a a list that has the following values:
{2,3,1,1,1}

This list represents the number of stacked walls elements.

It feels like something like the following would be a good start, but it is giving me some errors:

The counter would need to be reset if the first condition is met, but would need to be added together if the second condition keeps occurring.

Hopefully this makes sense.

What’s the first and second condition? I only see one if statement.

I am just calling the first conditional the “if” statement and the second conditional the “else” statement.

I am away from my computer for the rest of the night, but I think I maybe see some potential problems that I will explore tomorrow.

First one, value needs to have a value if the first conditional is met, a value of 1
Second one being that the value at the count index will keep getting overwritten if the walls are stacking, I would think that python could handle this, more than likely I just have syntax wrong or something.

Thanks again for all your help @kennyb6

Getting closer now to the goal, have to remove the extras "1"s in the output.