I’m trying to create rectangles from a list of points which is generated from the grid intersection points.
I just can not figure out how to group them into corner points to create rectangles.
Can you post a new image of your graph using Export to Image in the top right corner of Dynamo? Just make sure you’re zoomed in enough that the nodes are completely legible. You don’t have to fit everything in the window, it will all get exported. Also, please pin all the node preview bubbles so we can actually see what your data is doing.
Amigo @Ahmad.AbuZnait, buenas. I leave you some ideas, it is easier to make them with lines, because if you want rectangles you need to define the center point of the rectangle.
@Nick_Boyts here are a better screenshots of the scripts including what i want to achieve. I want to get the areas in between the grid intersections and want to these areas for further analysis.
@gilberto.arechigaiba the maximum/minimum point idea can achieve that but still need to iterate on all points to find them for each group of 4 points as these points represent the rectangle corners i want to have.
Lunchbox has nodes for paneling a surface. That process might be helpful here. You would just need to create a rectangular surface based on the min and max points and then convert the points to parameters on the surface.
The other option, which is a lot of list management, is to go row by row and column by column to pair up points so that you have your 4 points needed to create a rectangle.
Amigo @Ahmad.AbuZnait, assuming an existing grid, and that the distance between axes is regular, if I were you I would make an offset of half the distance between axes and re-evaluate the crosses to find the center of the rectangle and retake the previous idea, and the sides of the rectangles is the total of the side between axes, I leave an example I hope it helps you!!
Good evening,
here is a solution described by Mr. Nick
codeblock
x;
a;
b;
res=[];
result=[Imperative]
{
for (j in 0..(b-2))
{
for (i in 0..(a-2))
{
res[j][i]=Rectangle.ByCornerPoints(x[j][i],x[j][i+1],x[j+1][i+1],x[j+1][i]);
}
}
return res;
};
Cordially
christian.stan