I don't lay out by selecting objects such as a polyline. I do layout by selecting the pipes and structures I want, then start placing with upslope toggled so that my structures and pipes start at 1 at low end. Then I create an alignment/profile by selecting start structure and end structure. If the pipes are connected to the structures, the whole line will highlight. Also, by doing it this way, it only picks those pipes and structures (automatically) to throw in profile. I use the Pipe Network Tools to quickly change reference alignment.
Note, my pipe rules are set to structure center initially so that alignment vertices are created at center (insertion) of structure. Then I change end location to structure inner wall and apply rules so that I get a true pipe length.