Adjustable mesh size - stretching pipe

I need to deal with a problem of component size adjustable by user. In this project user will be creating pipeline model out of models exported from Blender (using exporting add-on). The library consists of various L, X, T,… shaped components (these are not to be scaled) which connects pipes with various diameter (these I need to adjust). I cannot scale the whole pipe because that would damage the look of flanges at both ends of the pipe.

In my opinion, the most elegant way would be somehow scale just the middle part of a mesh, but I don’t know if that’s possible.
The other way I was thinking about is to split pipe in library into 3pcs (flange in, middle part, flange out). Then I would scale middle part into desired length and I would connect all parts by method Mesh.MergeMeshes(arrayOfMeshes,…).

But is there any better way how to achieve desired behaviour?

Thanks in advance!

Welcome aboard!

I think splitting your meshes into 3 parts is indeed the best way to do it. If you have a lot of instances of the shapes to connect but not so many shapes, you can keep the 3 meshes separated and use thin instances to create duplicates of the meshes. That way, each shape will only cost 3 draw calls even if you use this shape 1000 times in the scene.

Ok, maybe keeping it split is also better for editing component “in place.” Thank you!