To solve the problem, each box and socket have parameters, apartment number and level (branching). The beginning (0), then the main boxes (2), then the secondary (1). There is also a box on the stove with a separate wire (4) and 2 boxes (3 and 5), which are connected to each other and the main box.
The script works, although it will need to be brought to readiness.
Logic: We define walls and doors (the difficulty is that they are in the linked model and they need to be identified and raised to the floor level). We determine the boxes and sockets in the apartment, we determine the walls and doors in the apartment. We are looking for doors through which wires from the Beginning, to the main outlets and the electric stove, go. We determine the secondary boxes lying in the room and connect them with the bending with the main ones. We connect the box with sockets.
Thanks to T_Pover, Dimitar Venkov, Daniel_Woodcock1, and others whose work helped me create the script.
Sincerely, Andrey Baranov.
Notes in scripts are made in Russian. I do not speak English very well …
I would be very grateful for the criticism. This is my second complicated script in Dynamo.
test7311111_VSE_Flex2.dyn (67.6 KB)