Modification Required in existing Dynamo Script

Hello Guys,

I have already Dynamo script to add A,B,C,D… in comments as per distance with project Base point (0,0,0).

Existing script

It Give Result as per below snap.

As you can see in snap nearest tray from base point dynamo assign “A” in comments. This is fine in some cases.

But i want to modify script as below snap see red text.

Logic : 1. in Snap i have two cable tray network (A to L and M to O). Now i want to add A letter in 1st tray of network-1,
once it assign all letter in network 1. then it should be start assigning next letter in 2nd network (in image it is M,N, and O)

I don’t know is it possible or or not. if possible then please provide your suggestion.

Regards,
Firozkhan Pathan

think it will be difficult that way…btw you have 2 cabletrays you wanna name J…

1 Like

no, there will be unique letter for each tray.
i.e. In 1st network last tray letter is E. Then, Next network 1st tray letter should be “F”.

or in another way suppose in 1st network ill give NET-1 in service type and NET-2 for 2nd network. Then is it possible ?

This is certainly possible, but achieving it with just OOTB nodes will probably be a bit of a pain. The way I would do it is by having the user select both the starting point, and all the elements to be sorted. Then loop through the list acquiring the endpoints of each element’s center line.
From there you can start with the element identified as your starting element, and then cycle through your list of points to find if any of those points overlap. Repeat until you’ve sorted the whole list.

Now, what I would suggest you do instead is check out the MEPover package. MEPover has various nodes that let you interact with an elements connectors. So you could select your starting point, and then use the ConnectedElements node to grab the next one in line. If you hit a T, you can add the extra one to a placeholder list to comeback and revisit.

1 Like

Can you please show me some examples as per the above statement ? or any reference scripts?

Looks to me that you may use similar logic to the Renumber Rooms graphs: Renumber rooms by spline - Not working consistently - #16 by truevis

Thanks, But this will not work in my case as The given snap is just example i m having lots of trays with multiple network.

I just found alternate way by putting “Elements in connected network” but its only select 1 network.
and, another issue is if I select 1st element then script give start numbering to next element. I don’t know why this happening any solution for this ?
Snap of Script:

as in image I have selected tray and its ID:1370481 which is my 1st component but in list tray fitting named : Elec - MV get listed 1st. Ideally it should be 2nd.