Hello! I have a list of lines with coordinates, I want to compare all X coordinates with X check which are the same and delete leaving only one!
The problem is that I am trying to create “grids” from the axis of the walls, and when I have a wall cut in two, at the same X coordinate for example, it ends up creating 2 “gridlines” one over the other, hence the attempt to list the coordinates except for repetitions.
I’ve tried it in various ways, with list get at index and others, but I didn’t get results, the closest I could get this was to list groups in equal X coordinates “but some equals end up going to another list”.
I hope someone can help me! Thank you in advance.
It looks like you should be able to just use a List.GetItemAtIndex node, with 0 as the index, using proper list levels.
I tried that, but it’s more complex, because the list keeps returning equal X coordinates, like the ones in the image.
The lines are grouped by the X coordinate of their start points, right? Theoretically, this should work then. Could you post the .dyn?
Yes, it follows attached …
Eixos_centros de paredes.dyn (8.4 KB)
At the end of the list I have to apply Grid.Byline and everything has to work without creating overlapping lines as it happens in the attached image
You could also try to extend the lines untill they intersect, filter the lines that do and make a new line from start point of the first line and the end point (or most far away) of the second line.
ok, but I have no idea how to do that, because it’s pretty much my second attempt with Dynamo
and what I have at the moment is a list with all the line coordinates, I think it would be more complex to do that than just filtering the coordinates that have the corresponding “x” and “y” coordinates, don’t you think? … I’m seeing if I can get any results with pythoncorrespondentes não acha?
This looks to be an issue with the floating point accuracy of the X-coordinates. For example, one number might be 15.00000000000 and one might be 15.000000000001. In the watch node, it only shows 3 decimal places, so this isn’t immediately apparent.
If you round the numbers to a certain number of digits, it should work.
Eixos_centros de paredes_atualizado.dyn (25.9 KB)
Is rounding before comparing an option? Doubles are instable from nature.
yes i think you are right, its more complex to do it like i suggested to solve this, but its more challenging.
make it a game that you can enjoy
Can always make it an integer. Multiply it by 10^# of decimal digits for accuracy and turn it into an int.
Even though this code has something wrong, I finished it all, I generated the lists for the x and y start and end points, but now it doesn’t generate lines on all walls anymore, it skips several, I don’t know what’s wrong … I tried to change rounding the coordinates multiplying, but it didn’t work either …
Eixos_centros_paredes_v02.dyn (29.0 KB)
Maybe the way is wrong? I’m trying a new alternative using this topic Join walls in intersecting / touching, which starts selecting walls and identifying their python intersections, but then I get a list with true and false, and I couldn’t filter it to display only true … What do you think? Should I keep trying in the previous method or start selecting and filtering the intersecting walls would be the best way?