Why is this not making pipes flat?

WAB_Make a pipe horizontal_3D.dyn (26.6 KB)

Hi I am trying to make pipes flat. This script works in a simple model but fails with a more complex model. Not sure why?

WAB_Make a pipe horizontal_3D.dyn (29.4 KB)

I used a Gemini Python Script to dissconect the pipe segement. Now it works. Next to apply to all pipes in a system.

Check your document warnings after running that script. I’m guessing the disconnects are pretty detrimental there.

WAB_Warning by element_Info.dyn (8.7 KB)

I used this vibe coded script to check it’s warnings. the modified pipe segment didn’t have any.

I would check my document in the UI before and after running the script. If the number of warnings differs then you have added a problem.

The original script is taking the halfway point of each pipe and setting the pipe to that Z-value.

It’s going to immediately break if you have any interconnected, sloped pipe. It’s also going to be problematic the second you include riser pipes in the model since you’ll have start + end points defined at the same location now.

Hi Jacob, can I ask? Would this script likely create a serious warning? I am busy at work and need a quick and easy way to make pipes flat, but I also don’t want to trash the models I am working in.

I don’t have a mode to test on, but I would be very careful about running it.

WAB_Make a pipe horizontal_#2_3D.dyn (29.4 KB)

I ran the previous script on a live project, so hopefully I didn’t do too much damage. I guess I am getting carried away with Vibe Coding python node scripts. I was under the opinion if you do it inside dynamo where you can control what elements are fed into the python node that it is safer that trying to run a python script using an an AI assistant.

I have created a new approach that changes the pipe slope to 0.

Do you have a model to test it on?

Hi Jacob, I prepared a file for upload, however after thinking about it I don’t think I can upload it. We have families in there shared with us from partner companies. I don’t think it is a good idea for me to upload it to the forum. Sorry, but thank you for your help.

Just a side note/For your info:
Do watch out when doing anything in dynamo/python/coding/etc, you should always do things on a detached version of a project(not a live project file) until you are happy with the results.

Then you test on a varied set of projects, then once all fine you can then run it on a live project.

On Vibe coding; vibe coding is good and bad, very bad if you do not understand the language/concepts/etc in question. So do watch out going forward.

Doesn’t have to be (and likely shouldn’t be) a real project. Just a representative set of pipes which are a reasonable replication of the conditions you have in a project that facilitate the us of the tool you’ve built.

PIPES TO BE MADE HORIZONTAL.rvt (3.4 MB)

Hi Jacob, it’s just something like this. I just need to make pipes flat so I can join them. The live model is messy and I just trying to find a way to clean it up a bit. For some pipes in the live project the slope or lack of slope is not vital because they are just shown on plan views. For pipes shown on sections on real drawings we do of course worry about slope and invert levels.

This is a PERFECT sample rvt.

I recommend building a ‘generic’ dataset like this for any scaled Revit automation, as it makes testing easy (testing is something you’ll have to do such on every Revit update and each version), and makes it will process faster (less items but replicates the issues you’re solving) and will open faster should you crash.

Poking my head into the graph now.

So, you’re making each pipe ‘flat’ in elevation without considering what elevation the adjacent pipe is at. This won’t help you make connections between the pipe as pipe 1 might have an average elevation of 100 units above the reference level, but pipe 2 might have an average elevation of 600 units above the reference level.

Instead I recommend working to the average, always referring to the pipes by their reference level (if someone moved a pipe in elevation form level A to level B you’ve got bigger problems to address first). The attached graph should do the trick.


pipes to plane.DYN (38.5 KB)

Thanks very much for this Jacob. This does what I needed.