Rename pipe based on structure name

Im starting to dive into Dynamo. To start off, I’m looking for a way to rename the pipes in my drawing. I currently have a network with structures which I manually named as CB 1, MH 1, CB 2, etc. I want to rename the pipes in between the structures to say the start structure to the end structure (for example, CB 1 TO MH 1).

Any tips on how to do this?

Here you are. Thanks to @mzjensen 's camber package. Make sure to download it for this to work.


NamePipesByStructureNames.dyn (50.4 KB)
Update Pipe Names - Post-Script.dwg (2.7 MB)
Update Pipe Names - Pre-Script.dwg (2.7 MB)

5 Likes

Thanks for the solution, it worked well. Curious what this node means; what does writing x[0] in code block do?
Capture

Is there a way to return a pipe network by name instead of the order it appears in the list? For example, if I currently just have one pipe network (storm) in this drawing and set it to x[0], dynamo will work fine. But if I later add another network, say sanitary, then storm will be pushed down in the list and I’ll have to renumber it to say x[1].

Sure. You can use the “PipeNetwork.GetPipeNetworkByName” node in the camber package and pass it the name of your pipe network as a string (use either a string node or text in a code block node in quotes).

But I imagine it will be easiest for your needs to simply click on a pipe to select the network to update. If that is the case you can do something like this:


NamePipesByStructureNames.dyn (49.3 KB)

1 Like

Thanks, I think clicking the pipe to select the network would be the best option since I wouldn’t have to modify anything in the code and then can be used for any drawing.

1 Like

The one caveat with that approach is that the script will break if anything other than a pipe is selected. But if you’re the only one using it, then it might not be a concern!

1 Like